index in "double" list

Larry Bates lbates at swamisoft.com
Tue Feb 3 09:32:48 EST 2004


If you have list:

t=[[1,"a"],[2,"b"],[3,"c"]]

The first element of each list contained
in t is accessed by:

t[n][0]

where n is the element number you wish to access
(zero based of course).

-Larry

"Boštjan Jerko" <bostjan.jerko at mf.uni-lj.si> wrote in message
news:mailman.1154.1075795507.12720.python-list at python.org...
> Hello!
>
> I have a list of lists (e.g. [[1,"a"],[2,"b"],[3,"c"]]) and
> would like to do index on the first element of the lists.
> Can it be done?
>
> B.
>





More information about the Python-list mailing list