[issue20811] str.format for fixed width float can return a string longer than the maximum specified

Stefan Krah report at bugs.python.org
Sat Mar 1 22:57:26 CET 2014


Stefan Krah added the comment:

aubmoon: Would it be a possibility just to use 'f' instead?

>>> "{:+10.7f}".format(1.12345678)
'+1.1234568'
>>> "{:+10.7f}".format(0.12345678)
'+0.1234568'

----------
nosy: +skrah

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20811>
_______________________________________


More information about the Python-bugs-list mailing list