When either a starting or an ending index is missing, they default to the beginning or end of the string, respectively. : Slice : String PYTHON TUTORIALS


PYTHON TUTORIALS » String » Slice »

 

When either a starting or an ending index is missing, they default to the beginning or end of the string, respectively.


aString = 'abcd'

print aString[2:]
print aString[1:]
print aString[:-1]
print aString[:]



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo String
» Slice