Message182126
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. |
|
Date |
User |
Action |
Args |
2013-02-15 00:16:50 | r.david.murray | set | recipients:
+ r.david.murray, mmokrejs |
2013-02-15 00:16:50 | r.david.murray | set | messageid: <1360887410.67.0.832931476602.issue17207@psf.upfronthosting.co.za> |
2013-02-15 00:16:50 | r.david.murray | link | issue17207 messages |
2013-02-15 00:16:50 | r.david.murray | create | |
|