how do i change from string to list

Peter Otten __peter__ at web.de
Mon Oct 25 04:07:08 EDT 2004
Michael Hoffman wrote:

> BJörn Lindqvist wrote:
>> How do you do the opposite? List to string? Shortest method I've found
>> is:
>> 
>>>>>''.join(["H", "e", "l", "l", "o"])
> 
> That is the obvious way to do it.

We have different notions of obviousness, obviously:

>>> str(['H', 'e', 'l', 'l', 'o'])
"['H', 'e', 'l', 'l', 'o']"

:-)

Peter




More information about the Python-list mailing list