On Feb 21, 5:53 pm, vsoler <vicente.so...@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...
Assuming that you're using Python 2.6 (or Python 3.x): >>> format(.7, '%') '70.000000%' >>> format(.7, '.2%') '70.00%' Or see TomF's response for how to use this with the str.format method. -- Mark -- http://mail.python.org/mailman/listinfo/python-list