formatting a number as percentage

Chris Colbert sccolbert at gmail.com
Sun Feb 21 19:14:57 CET 2010


>>> print('%.0f%%' % (0.7*100))
70%

On Sun, Feb 21, 2010 at 12:53 PM, vsoler <vicente.soler at gmail.com> wrote:

> I'm trying to print .7 as 70%
> I've tried:
>
> print format(.7,'%%')
> .7.format('%%')
>
> but neither works. I don't know what the syntax is...
>
> Can you help?
>
> Thank you
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100221/ec74a057/attachment.html>


More information about the Python-list mailing list