An index that is too large is replaced by the string size,largereplaced,word = 'Help
An index that is too large is replaced by the string size,largereplaced,word = 'Help
word = 'Help' + 'A'print word[:2] # The first two charactersprint word[2:] # All but the first two charactersprint word[1:100]print word[10:]print word[2:1]
相关内容
- String JOIN,stringjoin,print 'SPAM'
- Printing a List,printinglist,li = ['a', '
- Quotation inside a quotation,quotationinside,print 'knigh
- String slicing: extrace section,slicingextrace,S = 'spam'pr
- Splitting strings,splittingstrings,string1 = 'A
- Default Argument Values: a simple demo,argumentvalues,# specify a
- Python functions are 'typeless',pythontypeless,def
- A Simple function definition: return a tuple.,definitiontuple,def q
- Use lambda to define simple function,lambdadefine,def make_inc
- Assign value returned from function to a variable,assignreturned,de
评论关闭