how do i change from string to list
TheDolphin at ivonet.nl
Sun Oct 24 23:21:25 CEST 2004
I agree completely!
Didn't know the list() though.
But all work so my answer is just as valid as yours
"Ivo Woltring" <TheDolphin at ivonet.nl> wrote in message
news:417bf196$0$771$3a628fcd at reader20.nntp.hccnet.nl...
> lst =  # declare the list first
> for letter in str:
> lst.append(letter) # append to the list
> print lst
> result: ['s', 'p', 'o', 't']
> "john" <miodio67 at hotmail.com> wrote in message
> news:99ca2e2f.0410241005.39a4f1db at posting.google.com...
> > I have the following
> > s = "spot"
> > which I would like to change to a list
> > l = ['s','p','o','t']
> > I have tried l = eval(s) but I get the error
> > File "<string>", line 1, in ?
> > NameError: spot
> > thank you all for your time
More information about the Python-list