On Thu, Sep 13, 2007 at 01:50:51PM -0700, Harlin Seritt wrote regarding Decimal formatting: > > Cant believe I have to post this and get help... and can't believe I > couldnt Google it reasonably well enough... I need to take a float > variable and have it display as a string to always have two decimal > places: > > 12.3333 -> 12.33 > 1.0 -> 1.00 > etc... > > Anyone willing to help with this one? > > thanks, > > Harlin >
f = 12.333333 i = 10 f_output = "%0.2f" % f i_output = "%0.2f" % i Cheers, Cliff -- http://mail.python.org/mailman/listinfo/python-list