Adding a comma to a string

5

Good personal and possible add comma in an example string:

a = '1234567890abcdefghijklmnopqrstuvwxyz_'

So that she stays like this a = 1,2,3,4,5,6,7....

    
asked by anonymous 04.12.2015 / 22:13

1 answer

5

Do the following:

lst = list(a) // transforma sua string em lista 
txt = ",".join(lst) // coloca vírgula entre as letras

Note that this can be done in just one step:

a = ",".join(a)
    
04.12.2015 / 22:48