On 23/05/2016 18:05, Ian Kelly wrote:
On Mon, May 23, 2016 at 10:39 AM, Robin Becker <ro...@reportlab.com> wrote:
.........

If you want to show the float in a less noisy format, you can
explicitly format it using the 'g' or 'n' presentation type, which
essentially round to a given precision and strip off trailing zeros:

>>> '{:g}'.format(3*0.2)
'0.6'
thanks; looking in 2.7 source I believe that the old float.__str__ behaved like '%.12g' formatting. I can't imagine why people thought this was a 'good' idea though.
--
Robin Becker

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to