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>
    "".join(list(range(10)))
TypeError: sequence item 0: expected string, int found

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

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to