easy float question just eludes me

nephish nephish at xit.net
Thu Jul 28 10:01:48 EDT 2005


oops, i dont seem to have a module decimal
-shawn

On 07/28/2005 08:48:27 AM, Simon Brunning wrote:
> On 28 Jul 2005 06:39:32 -0700, nephish at xit.net <nephish at xit.net>
> wrote:
> > 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
> 
> >>> import decimal as dec
> >>> dec.Decimal('250.00')/100
> Decimal("2.50")
> 
> --
> Cheers,
> Simon B,
> simon at brunningonline.net,
> http://www.brunningonline.net/simon/blog/
> 
> 




More information about the Python-list mailing list