Rounding up to the next 100

Arnaud Delobelle arnodel at googlemail.com
Thu Jan 21 16:32:12 EST 2010


noydb <jenn.duerr at gmail.com> writes:

> If one has a floating number as a string, is there a spiffy way to
> round that string-number UP to the nearest 100?
>
> XstrNmbr = 3579.127893 -- would want to round that to 3600.
>
> Thanks for any help!

>>> XstrNmbr = 3579.127893
>>> round(float(XstrNmbr), -2)
3600.0
>>> 

HTH

-- 
Arnaud



More information about the Python-list mailing list