how to change the time string into number?

Tim Chase tim at thechases.com
Wed Aug 13 22:01:11 EDT 2014


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.

-tkc





More information about the Python-list mailing list