time.strptime intolerant on weekday string length?

Fredrik Lundh fredrik at pythonware.com
Tue Sep 13 13:56:22 EDT 2005


Robert wrote:

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

> I also don't see how to alter the pattern for strptime to be tolerante for
> more long weekday strings?
> Any ideas?

why bother parsing the day name at all?  (just split the string at the first
command and use strptime on the rest)

> Shouldn't it be possible to insert real regexp-like stuff in the pattern?

if you need an RE, use an RE.  no need to use strptime if you don't what
that behaviour (to convert the RE result to a time value, use time.mktime,
calender.timegm, or the datetime module, depending on what you want)

</F> 






More information about the Python-list mailing list