for any ranges [start:end], we get all characters starting at offset start up to, but not including, the character at end. : slice « String « Python Tutorial






aString = 'abcd'

print aString[0]
print aString[1:3]
print aString[2:4]
final_index = -len(aString)
print aString[-1]
print aString[-3:-1]
print aString[-4]








5.29.slice
5.29.1.Slice a string
5.29.2.How to Access Values (Characters and Substrings) in Strings
5.29.3.for any ranges [start:end], we get all characters starting at offset start up to, but not including, the character at end.
5.29.4.When either a starting or an ending index is missing, they default to the beginning or end of the string, respectively.