int to str in list elements..

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Tue Oct 16 03:24:32 EDT 2007


On Tue, 16 Oct 2007 06:18:51 +0000, Tim Roberts wrote:

> John Machin <sjmachin at lexicon.net> wrote:
>>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.
> 
> It's an interesting mental exercise to try to figure out just how large
> that string will be, without using Python.
> 
> I get 30,888,889 bytes...

I think you have an off by one error here.  (One number, not one byte)  :-)

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list