Change string to a list and Reference its index : list « Buildin Function « Python






Change string to a list and Reference its index

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


           
       








Related examples in the same category

1.Change string to a listChange string to a list
2.Join list to a stringJoin list to a string
3.Convert string to a list and add them togetherConvert string to a list and add them together