time.strptime intolerant on weekday string length?

Robert k.robert at gmx.de
Tue Sep 13 12:52:11 EDT 2005


A certain DAV server reports a time stamp as "Tues, 30 Aug 2005 20:48:31"
( but not "Tue, ..."  as usual)

This produces the error below.

>>> time.strptime("Tue, 30 Aug 2005 20:48:31","%a, %d %b %Y %H:%M:%S")
(2005, 8, 30, 20, 48, 31, 1, 242, -1)
>>> time.strptime("Tues, 30 Aug 2005 20:48:31","%a, %d %b %Y %H:%M:%S")
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\Python23\lib\_strptime.py", line 425, in strptime
    raise ValueError("time data did not match format:  data=%s  fmt=%s" %
ValueError: time data did not match format:  data=Tues, 30 Aug 2005 20:48:31
fmt=%a, %d %b %Y %H:%M:%S
>>>


I also don't see how to alter the pattern for strptime to be tolerante for
more long weekday strings?
Any ideas?
Shouldn't it be possible to insert real regexp-like stuff in the pattern?

Robert





More information about the Python-list mailing list