Mega Code Archive

 
Categories / Python / Buildin Function
 

Change string to a list and Reference its index

S = 'spammy' L = list(S) print L L[3] = 'x'              # works for lists, not strings L[4] = 'x' print L