[Tutor] Decimal truncation, rounding etc.

Joe Cox jgcox39 at highstream.net
Thu Oct 26 04:03:59 CEST 2006

My next project is to read a doc file and do some number editing.
I can alter numbers in the Interactive Shell OK:

import math
print round(7.12345,4)

from decimal import*
Decimal('7.00000').quantize(Decimal('1.000'),rounding = decimal.ROUND_DOWN)

But when I go in to IDLE, I just don't seem to be able to make this work.

A typical line of code for me to read and edit will look like:
G01 G91 X7.12345 Y7.0000 Z-0.0086 
The underlines is what I need to edit, as above.

I must not understand something fundamental.

Joe Cox
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061025/5eb771ef/attachment.html 

More information about the Tutor mailing list