how do i change from string to list

Ivo Woltring TheDolphin at ivonet.nl
Mon Oct 25 18:29:28 CEST 2004


agreed
But I wasn't aware of the list() function and than my version wasn't so bad

but I agree about the more considerations though

Ivo

"John Machin" <sjmachin at lexicon.net> wrote in message
news:c76ff6fc.0410241958.7222d1f0 at posting.google.com...
> "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