Why %e not in time.strftime directives?
Tim Chase
python.list at tim.thechases.com
Sun Dec 14 14:34:24 EST 2008
>>> Any special reasons?
>> Because it is there (at least on my Debian box)?
>
> But not on windows :(
>>>> import time
>>>> time.strftime("%e")
> ''
Guess you'll have to take it up with the authors of strftime() at
Microsoft :)
>> The full set of format codes supported varies across
>> platforms, because Python calls the platform C library's
>> strftime() function, and platform variations are common.
>>
>> So if your underlying C implementation of strftime() supports "%e", then
>> Python will. My guess is that the same applies to time.strftime as it does
>> to datetime.strftime
>>
>> The docs list ones that are fairly cross-platform. However, it would seem
>> that not all platforms support "%e"
If you don't have any luck convincing Microsoft to add "%e" to
their strftime implementation, you can use
strftime('%d').lstrip('0').rjust(2)
to replicate the desired behavior :)
-tkc
More information about the Python-list
mailing list