How convert all list/tuple...

Irmen de Jong irmen at NOSPAMREMOVETHISxs4all.nl
Mon Jun 10 17:04:11 EDT 2002


> I wish to translate something like:
>  [1,2,"string"]
> into:
>  ['1','2','string']

This is an easy one, either use map or a list comprehension:

map(str,[1,2,"string"])
   or,
[str(x) for x in [1,2,"string"]]

Irmen




More information about the Python-list mailing list