On 2014-08-13 21:01, Tim Chase wrote:
> On 2014-08-14 09:46, luofeiyu wrote:
> > s="Aug"
> > 
> > how can i change it into 8 with some python time module?
> 
>  >>> import time
>  >>> s = "Aug"
>  >>> time.strptime(s, "%b").tm_mon
>  8
> 
> works for me.

Or, if you want a more convoluted way:

 >>> import calendar as c
 >>> [i for i, m in enumerate(c.month_abbr) if m == "Aug"].pop()
 8

-tkc



-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to