Rounding up to the next 100

Michael.Coll-Barth at Michael.Coll-Barth at
Thu Jan 21 22:30:13 CET 2010


> From: noydb

> 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.

What's wrong with round?  round( XstrNmbr, -2 ) seems to do the trick.
Or do you want to get rid of the decimal point as well?

The information contained in this message and any attachment may be
proprietary, confidential, and privileged or subject to the work
product doctrine and thus protected from disclosure.  If the reader
of this message is not the intended recipient, or an employee or
agent responsible for delivering this message to the intended
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify me
immediately by replying to this message and deleting it and all
copies and backups thereof.  Thank you.

More information about the Python-list mailing list