round off to two decimal & return float

ஆமாச்சு amachu at
Sat Mar 30 08:52:59 CET 2013

Consider the scenario,

>> a = 10
>> "{0:.2f}".format(a)

This returns a string 10.00. But what is the preferred method to retain
10.0 (float) as 10.00 (float)?

I am trying to assign the value to a cell of a spreadsheet, using
python-xlwt. I would like to have 10.00 as the value that is right
aligned. With text it is left aligned.


Sri Ramadoss M

More information about the Python-list mailing list