Sorting a list

John Salerno johnjsal at NOSPAMgmail.com
Thu Feb 1 14:54:09 EST 2007


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. :)



More information about the Python-list mailing list