easy float question just eludes me
Sergei Organov
osv at javad.ru
Thu Jul 28 09:59:54 EDT 2005
nephish at xit.net writes:
> Hullo all !
>
> i have a real easy one here that isn't in my book.
> i have a int number that i want to divide by 100 and display to two
> decimal places.
>
> like this float(int(Var)/100)
> but i need it to display the .00 even if it does not have a .00 value
> like this
> if Var is 50, i need to display .50 instead of just .5
>
> i know there is an easy way to do this.
>>> print "%.2f" % (50./100)
0.50
More information about the Python-list
mailing list