◐ Shell
clean mode source ↗

Message 69192 - Python tracker

strptime() allows 60 and 61 sec, but not 62 sec in arg. string 

>>> s='02/28/2000 12:33:61 AM'
>>> time.strptime(s,'%m/%d/%Y %I:%M:%S %p')
(2000, 2, 28, 0, 33, 61, 0, 59, -1)

>>> s='02/28/2000 12:33:62 AM'
>>> time.strptime(s,'%m/%d/%Y %I:%M:%S %p')

Traceback (most recent call last):
  File "<pyshell#12>", line 1, in <module>
    time.strptime(s,'%m/%d/%Y %I:%M:%S %p')
  File "C:\Python25\lib\_strptime.py", line 330, in strptime
    (data_string, format))
ValueError: time data did not match format:  data=02/28/2000 12:33:62 AM
 fmt=%m/%d/%Y %I:%M:%S %p