Author sverrejoh
Recipients sverrejoh
Date 2010-09-09.09:59:02
SpamBayes Score 2.58319e-10
Marked as misclassified No
Message-id <>
There seems to be a platform difference in the way stftime handles 
unknown format codes.

In OSX Python removes the percentage sign from the returned string when the format code is unknown. In Linux it leaves it.

Look at the following example:

This is Python 3.1.2 in Ubuntu:

    Python 3.1.2 (r312:79147, Apr 15 2010, 15:35:48) 
    [GCC 4.4.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import datetime

And this is Python 3.1.2 on Max OSX:

    Python 3.1.2 (r312:79147, Sep  9 2010, 11:11:24) 
    [GCC 4.2.1 (Apple Inc. build 5664)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import datetime

I've gotten the same result in 2.5, 2.6 and 3.1.

FYI, this broke some code that parsed the same string first with strftime, and then used string interpolation (The mac version
deleted all percentage signs before '('):

    >>>"%Y - %(foobar)s") % {"foobar": "egg"}

This does not work in OSX.
Date User Action Args
2010-09-09 09:59:05sverrejohsetrecipients: + sverrejoh
2010-09-09 09:59:05sverrejohsetmessageid: <>
2010-09-09 09:59:03sverrejohlinkissue9811 messages
2010-09-09 09:59:02sverrejohcreate