Mega Code Archive

 
Categories / Python / String
 

String slicing

S = 'spam' print S[1:3], S[1:], S[:-1]     # slicing: extract section