[New-bugs-announce] [issue1158] %f format for datetime objects

Skip Montanaro report at bugs.python.org
Thu Sep 13 04:26:44 CEST 2007

New submission from Skip Montanaro:

Attached is a patch for py3k which adds a %f format code to its strftime
method.  When included in a format string it expands to the number of
microseconds in the object.  date, time and datetime objects all support
the format (though I'm not sure what, if anything, it means for date

I don't know how practical this is for time.strftime() level because the
inputs are all so excited about being ints.  Still, if you wanted to
allow the seconds field to be a float and were willing to cast it to an
int where necessary and shadow struct tm with a pseudo-float-friendly
version of the same, you could probably smash it in there as well.

components: Extension Modules
files: percent-f.diff
keywords: patch, py3k
messages: 55876
nosy: skip.montanaro
priority: normal
severity: normal
status: open
title: %f format for datetime objects
type: rfe
versions: Python 3.0

Tracker <report at bugs.python.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: percent-f.diff
Type: text/x-diff
Size: 2351 bytes
Desc: not available
Url : http://mail.python.org/pipermail/new-bugs-announce/attachments/20070913/f31a009c/attachment.diff 

More information about the New-bugs-announce mailing list