transform list of int in a list of string??

Skip Montanaro skip at pobox.com
Fri Sep 13 14:20:38 EDT 2002


    juliano> How can i transform a list of integer numbers in a list of
    juliano> string numbers, like that: 

    juliano> x=[1,2,3,4] to y=['1', '2'...]????????

Try 

    y = map(str, x)

or

    y = [int(n) for n in x]

-- 
Skip Montanaro
skip at pobox.com
consulting: http://manatee.mojam.com/~skip/resume.html




More information about the Python-list mailing list