Sorting a list

Carroll, Barry Barry.Carroll at psc.com
Thu Feb 1 15:03:28 EST 2007


> -----Original Message-----
> From: John Salerno [mailto:johnjsal at NOSPAMgmail.com]
> Sent: Thursday, February 01, 2007 11:54 AM
> To: python-list at python.org
> Subject: Re: Sorting a list
> 
> Bruno Desthuilliers wrote:
> > John Salerno a écrit :
> >> Hi everyone. If I have a list of tuples, and each tuple is in the form:
> >>
> >> (year, text) as in ('1995', 'This is a citation.')
> >>
> >> How can I sort the list so that they are in chronological order based
> >> on the year?
> >
> > Calling sort() on the list should just work.
> 
> Amazing, it was that easy. :)
Hello, John.

Yeah.  That's one of the things that drew me to Python: so many things you want to do are just so *easy* in Python.

Regards,
 
Barry
barry.carroll at psc.com
541-302-1107
________________________
We who cut mere stones must always be envisioning cathedrals.

-Quarry worker's creed





More information about the Python-list mailing list