how do i change from string to list

John Machin sjmachin at lexicon.net
Mon Oct 25 05:58:40 CEST 2004


"Ivo Woltring" <TheDolphin at ivonet.nl> wrote in message news:<417c1cda$0$152$3a628fcd at reader1.nntp.hccnet.nl>...
> I agree completely!
> Didn't know the list() though.
> But all work so my answer is just as valid as yours
> 
> ;-))
> Ivo

This will probably work, too -- is it "valid"?

s = 'spot'
slen = len(s)
alist = [''] * slen
for i in range(slen):
    alist[i] = s[i]

You can write code in Perl or Intercal [bonus points if you can tell
the difference] and it's "valid" in the sense that it works, but there
are many more considerations than that.



More information about the Python-list mailing list