retreving data from a sublist

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Tue May 6 08:18:50 EDT 2003


Michael Fortune wrote:
> how do you retreive data from a sublist
> 
> i.e. list[[45,89,00,],[8,37,22]]
> 
> i want to print only 37
> tryied print list[2[1]]

Close... try:

print list[1][1]

instead. You first get the second (index 1) element of the outer
list, and from that, you again get the second (index 1) element.

And please don't use "list" as a name, it hides the builtin "list".

--Irmen





More information about the Python-list mailing list