Getting at an item in a list of tupples
Fernando Pérez
fperez528 at yahoo.com
Mon Dec 10 13:13:45 EST 2001
Emile van Sebille wrote:
>>>> a
> [(1, 2.0, '3'), (11, 12.0, '13'), (21, 22.0, '23')]
>>>> max([i[1] for i in a])
>
Nice. I just sent in a solution using map(), but this does look more readable
(and may be quicker, since it doesn't require calling a selection lambda()).
Note to self: must get used to using list comprehensions more.
Cheers,
f.
More information about the Python-list
mailing list