[Reserved] for personal use Python learning Essay: string interception

= STR '0123456789'
print STR [0:. 3] #, taken first to third character
print str [:] # of all the character strings taken
print str [6:] # taken to the end of the seventh character
print str [: - 3] #, taken from the beginning until the antepenultimate character
print str [2] # characters taken third
print str [-1] # penultimate taken a character
print str [:: - 1] # creating a reverse order of the original string string
print str [-3: -1] # character, taken with the bottom third of the penultimate one previous
print str [-3:] # taken countdown to the end of the third
print str [: - 5: -3] # reverse the interception, did not thoroughly understand the specific what do you mean?

Guess you like

Origin www.cnblogs.com/wayne-tao/p/11413481.html