List to string? Docstrings?
tre17 at student.canterbury.ac.nz
tre17 at student.canterbury.ac.nz
Mon Sep 13 19:17:01 EDT 1999
François Pinard <pinard at iro.umontreal.ca> writes:
> Hello, people. Still learning Python. I wrote around 6000 Python lines
> in the last 10 days! :-) I have two quick questions for you.
>
> 1) For converting a string into a list, I used:
>
> chars = list(text)
>
> For getting back the string from the list, I tried:
>
> import operator
> text = reduce(operator.concat, chars)
>
> but still, I wonder if you would not have a better suggestion...
>
[snip]
import string
text = string.join(list, '')
--
Tim Evans
More information about the Python-list
mailing list