transform list of int in a list of string??

Steve Holden sholden at holdenweb.com
Fri Sep 13 15:12:29 EDT 2002


"Skip Montanaro" <skip at pobox.com> wrote ...
>
>     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 of course meant

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

in his second example.

regards
-----------------------------------------------------------------------
Steve Holden                                  http://www.holdenweb.com/
Python Web Programming                 http://pydish.holdenweb.com/pwp/
Previous .sig file retired to                    www.homeforoldsigs.com
-----------------------------------------------------------------------






More information about the Python-list mailing list