I am out of trial and error again Lists

Terry Reedy tjreedy at udel.edu
Thu Oct 23 08:31:15 CEST 2014

On 10/22/2014 10:58 PM, Larry Hudson wrote:

> This give you a list not a string, but that's actually what you want
> here.  If you _really_ want a string, use join():  "".join(list(range(10)))

Interactive mode makes it really easy to test before posting.

 >>> "".join(list(range(10)))

Traceback (most recent call last):
   File "<pyshell#0>", line 1, in <module>
TypeError: sequence item 0: expected string, int found

 >>> "".join(str(i) for i in range(10))

Terry Jan Reedy

More information about the Python-list mailing list