int to str in list elements..

John Machin sjmachin at lexicon.net
Sun Oct 14 23:38:17 CEST 2007


On Oct 15, 4:02 am, Abandoned <best... at gmail.com> wrote:
> Hi..
> I have a list as a=[1, 2, 3 .... ] (4 million elements)
> and
> b=",".join(a)
> than
> TypeError: sequence item 0: expected string, int found
> I want to change list to  a=['1','2','3'] but i don't want to use FOR
> because my list very very big.

What is your worry: memory or time? The result string will be very
very very big. What will you do with the result string -- write it to
a file? If so, look at the cPickle module.




More information about the Python-list mailing list