putting date strings in order

noydb jenn.duerr at gmail.com
Tue May 12 05:06:43 CEST 2009


How best to go about this?  >>

I have a list containing strings referring to months, like ["x_apr",
"x_jul", "x_jan", "x_aug", "x_may", etc] -- always using the 3-chars
for month.  The list will contain all 12 months, however the starting
month may not necessarily be jan.  I want to order the list
chronologically, but starting with the user-defined starting month.
So a list could be [x_aug, x_sep, .... x_jul].  The list might just
start off in any random order, but I need to ensure, in the end, that
the list is in chronological order and starting with the proper month
per user needs.

Anyone have any good ideas?  I was curious to see what people came up

More information about the Python-list mailing list