round/float question

Sagiv Malihi malihi1 at 012.net.il
Thu Oct 16 19:25:47 EDT 2003


what you did was fine -
>>> a = 2.123
>>> round(a,2)
2.1200000000000001
>>>

round (var, ndigits) will return the variable rounded to as many digits
after the decimal point as you want.
(perhaps your problem was with the square brackets? they are obviously not
needed )
        sagiv.


"Jason Tesser" <JTesser at nbbc.edu> wrote in message
news:mailman.1065809636.26201.python-list at python.org...
I am using Rekall which uses Python as it's scripting language  and I have a
question about Python.  I am developing a POS system and am working on
the checkout form. I pass a parameter named SaleID and another one named
Total.  I am trying to take total and convert it to a float with 2 decimals
top be used as money obviously.  What would be the proper syntax for this?
I tried Total = round(Total [, 2]) i also tried that with float.

Jason Tesser
Web/Multimedia Programmer
Northland Ministries Inc.
(715)324-6900 x3050







More information about the Python-list mailing list