ISO to Gregorian, strptime madness

Peter Hansen peter at engcorp.com
Thu Dec 4 10:43:38 EST 2003


Afanasiy wrote:
> 
> While I'm posting, how about this old dilemma... from the 2.3 modules.
> strptime exists in time, but not in datetime, while strftime exists in
> both. 

Uh, really?

C:\>python23
Python 2.3.2 (#49, Oct  2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
>>> import time
>>> import datetime
>>> time.strftime
<built-in function strftime>
>>> time.strptime
<built-in function strptime>
>>> datetime.strftime
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 'strftime'
>>> datetime.strptime
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 'strptime'


Looks to me like strptime and strftime are both in time and not in datetime.

-Peter




More information about the Python-list mailing list