This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients belopolsky, lavajoe, r.david.murray, spaetz
Date 2011-01-28.23:33:22
SpamBayes Score 5.8689157e-06
Marked as misclassified No
Message-id <1296257603.74.0.701541743237.issue11024@psf.upfronthosting.co.za>
In-reply-to
Content
I would write the formatting code as follows:

('"%2d-%s-%04d %02d:%02d:%02d %+03d%02d"' %
 ((tt[2], _month_names[tt[1]], tt[0]) +
   tt[3:6] + divmod(zone//60, 60)))

The above also assumes that month names are stored in a 1-based array:

_month_names = [None, 'Jan', ...]

Note that %2d format code takes care of space-padding.

If you think the expression that I conjured is too cryptic, get the temporal data from timetuple first with say

y, m, d, H, M, S = tt[:6]

and use named variables in the formatting expression.
History
Date User Action Args
2011-01-28 23:33:23belopolskysetrecipients: + belopolsky, r.david.murray, lavajoe, spaetz
2011-01-28 23:33:23belopolskysetmessageid: <1296257603.74.0.701541743237.issue11024@psf.upfronthosting.co.za>
2011-01-28 23:33:23belopolskylinkissue11024 messages
2011-01-28 23:33:23belopolskycreate