how do i change from string to list

Michael Hoffman at
Sun Oct 24 21:10:41 CEST 2004

Ivo Woltring wrote:
> str='spot'
> lst = [] # declare the list first
> for letter in str:
>     lst.append(letter) # append to the list
> print lst

I just would have used list("spot").

> result: ['s', 'p', 'o', 't']

Same result but faster, more transparent, and with a lot less code.

Also, please don't top-post.
Michael Hoffman

More information about the Python-list mailing list