[Tutor] Re: Converting month names to abbreviated form

Lee Harr missive at hotmail.com
Sun Jul 25 19:10:48 CEST 2004


>Are there any known routines for converting month names to their
>abbreviated form (i.e., December->Dec) ?
>
>I was looking at the time module, but it didn't look very promising.
>


Sometimes the time module will surprise you.

>>>import time
>>>time.strptime('December', '%B')
(1900, 12, 1, 0, 0, 0, 5, 335, -1)
>>>time.strftime('%b', time.strptime('December', '%B'))
'Dec'

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus



More information about the Tutor mailing list