number of displayed decimal places
Vojin Jovanovic
vjovanov at stevens-tech.edu
Wed May 15 12:59:06 EDT 2002
I would like to know if one can control the number of displayed decimal
places in Python similarly to what one can do in MATLAB
for example
EDU» a=1.12345678901234567890123456789
a =
1.12345678901235 ///default is to display 14 decimal places which is the
precision of the calculation
EDU» format short ///but the number of decimal places that is displayed
can be changed
EDU» a
a =
1.1235
EDU» format long
EDU» a
a =
1.12345678901235 //// without changing the precision of the
calculations
Now, I know that Python can control the outputs with print %f and so on
... but it would be more useful if one can somehow set the number of
displayed decimal places in the beginning.
Vin
More information about the Python-list
mailing list