putting date strings in order

noydb jenn.duerr at gmail.com
Mon May 11 23:06:43 EDT 2009


All,

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
with.



More information about the Python-list mailing list