Mega Code Archive

 
Categories / Python / String
 

String indexing

S = 'spam' print S[0], S[-2]               # indexing from front or end