time, calendar, datetime, etc

Juha Autero Juha.Autero at iki.fi
Thu Jul 31 09:18:43 CEST 2003


kylotan at hotmail.com (Kylotan) writes:

> PS. I use 'time.strptime(myTime, '%a %b %d %H:%M:%S %Y')' as a
> reverse-asctime(), and was surprised that I couldn't find this wrapped
> in a function in any of the modules. Maybe such a function would be
> considered for future addition?

That's probably because it's easier to do it with time.strptime(). From 
documentation:
      The format parameter uses the same directives as those used by
      strftime(); it defaults to "%a %b %d %H:%M:%S %Y" which matches
      the formatting returned by ctime()

Which means that time.strptime() without format parameter acts as
reverse-asctime().

Maybe documentation should state "which matches the formatting
returned by ctime() and asctime()" since both functions use the same
formatting. 
-- 
Juha Autero
http://www.iki.fi/jautero/
Eschew obscurity!






More information about the Python-list mailing list