Hans Mulder <[email protected]> wrote: >> Did you try this: >> >>>>> print('%d%%' % (0.7 * 100)) >> 70% > >That method will always round down; TomF's method will round to >the nearest whole number: > > >>> print "%d%%" % (0.698 * 100) >69% > >>> print "{0:.0%}".format(.698) >70%
It was intended as a hint to this way of formatting. He could also try:
>>> print('%.0f%%' % (0.698 * 100))
70%
Best regards,
Günther
--
http://mail.python.org/mailman/listinfo/python-list
