[Tutor] obtaining an item from a list

Benoit Dupire bdupire@seatech.fau.edu
Tue, 08 May 2001 00:21:50 -0400


Is your list  [e, e, e, e] or  ['e','e','e','e'] ?
A list can't be [e, e, e, e]. If you initialize it in this way, then - e -  is
replaced by its value...

If you list is really [e, e, e, e] , let's say [10, 10, 10, 10], you can use
either str(list[0]) or repr(list[0]).

If i consider the second possibility, then you can use the string as a name -->
list[0] is a string, right ?

Hope this helps,
Benoit


Julieta Rangel wrote:

> If I have a list, say l=[e,e,e,e], how can I give the first item in my list
> a name and print it?
>
> Julieta
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

--
Benoit Dupire
Graduate Student
----------------
I'd like to buy a new Boomerang. How can i get rid of the old one?