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 r.david.murray
Recipients mmokrejs, r.david.murray
Date 2013-02-15.00:16:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1360887410.67.0.832931476602.issue17207@psf.upfronthosting.co.za>
In-reply-to
Content
You appear to be mixing up % style formatting and 'format' style formatting, especially since you seem to be using both in your examples, which is redundant.

Please see http://docs.python.org/2.7/library/string.html#format-string-syntax for the explanation of the format method, including the % presentation type.

Your questions will probably be answered better and more thoroughly if you post to the python-lits mailing list (the tracker is not a place to get help, I'm afraid), but some quick hints:  In Python2.7, 1/10 is 0. In a 'format' format string you can get what it sounds like you want by doing this:

  >>> '{:.2f}%'.format(12.67777)
  '12.68%'

In % style formatting you would do

  >>> '%.2f%%' % 12.67777
  '12.68%'

This is all well documented, but if you can see places it could be clarified, please let us know.
History
Date User Action Args
2013-02-15 00:16:50r.david.murraysetrecipients: + r.david.murray, mmokrejs
2013-02-15 00:16:50r.david.murraysetmessageid: <1360887410.67.0.832931476602.issue17207@psf.upfronthosting.co.za>
2013-02-15 00:16:50r.david.murraylinkissue17207 messages
2013-02-15 00:16:50r.david.murraycreate