month name to month number and vice versa in python
Question: I am trying to create a function that can convert a month number to an
abbreviated month name or an abbreviated month name to a month number. I
thought this might be a common question but I could not find it online.

I was thinking about the
[calendar](http://docs.python.org/library/calendar.html) module. I see that to
convert from month number to abbreviated month name you can just do
`calendar.month_abbr[num]`. I do not see a way to go the other direction
though. Would creating a dictionary for converting the other direction be the
best way to handle this? Or is there a better way to go from month name to
month number and vice versa?


Answer: Just for fun:

    
    
    from time import strptime
    
    strptime('Feb','%b').tm_mon
    

