[Tutor] %T as a strftime format identifier

Steven D'Aprano steve at pearwood.info
Sat Nov 27 09:10:35 CET 2010

Terry Carroll wrote:

> My question: was %T ever a valid format specifier in Python?  My best 
> guess is that it was when Edna was written (the most current release is 
> from 2006, and the docs say it needs at least Python 1.5.2, which gives 
> you an example of its age).  It seems odd that the format identifier 
> would be dropped if it had existed, though; that seems like a needless 
> upward compatibility issue.

Works for me:

[steve at sylar ~]$ python2.5
 >>> import time
 >>> time.strftime("%T")

and similarly for other versions as well. I think what you are seeing is 
differences in the C compiler, not deliberate language changes. As I 
recall it, the time format identifiers are dependent on the C library 
used to compile the time module, and/or the locale. If the C library 
involved doesn't recognise %T, neither will Python.

On the other hand, %T isn't listed in the manual:



More information about the Tutor mailing list