putting date strings in order

John Machin sjmachin at lexicon.net
Tue May 12 15:27:21 CEST 2009

MRAB <google <at> mrabarnett.plus.com> writes:
> Sort the list, passing a function as the 'key' argument. The function
> should return an integer for the month, eg 0 for 'jan', 1 for 'feb'. If
> you want to have a different start month then add

and if you don't like what that produces, try subtract :-)

> the appropriate
> integer for that month (eg 0 for 'jan', 1 for 'feb') and then modulo 12
> to make it wrap around (there are only 12 months in a year), returning
> the result.


More information about the Python-list mailing list