I have this months array:
[\"January\", \"March\", \"December\" , \"October\" ]
And I want to have it sorted like this:
[\"
Create a mapping:
month_map = {"January":1,
"February":2,
"March":3,
"April":4} # etc..
Use the mapping to compare one month to the other.
OR
Most languages/frameworks have objects for handling dates. Create date objects for all the months and compare them using the native (if available) inequality operators or basic sorting functions:
import datetime
January = datetime.date(2010,1,1)
February = datetime.date(2010,2,1)
if February < January: print("The world explodes.")