Sorting list (maybe stupid)
Chris Barker
Chris.Barker at noaa.gov
Tue Jun 11 12:55:49 EDT 2002
Eric Brunel wrote:
> l = [(102, 'foo'), (2, 'bar'), (1, 'baz')]
> l.sort()
> print l
>
> Apparently, the default sort function already sorts tuples according to
> their first element...
Note that this only works if the rest of the elements in the tuples are
also sortable. In this case, they are strings, so they are.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the Python-list
mailing list