Getting at an item in a list of tupples

Bob Greschke bob at passcal.nmt.edu
Wed Dec 12 10:51:09 EST 2001


"Fernando Pérez" <fperez528 at yahoo.com> wrote in message
news:9v695t$blv$1 at peabody.colorado.edu...
> 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.

Whew!  Me too! :)

Thanks, Emile!

Bob






More information about the Python-list mailing list