How to print floating point in scientific format?

Cousin Stanley CousinStanley at hotmail.com
Sat Aug 9 12:07:28 EDT 2003


The conversion to e format in the print statement
seems to work OK if I iterate over the items in the array ....

>>> import Numeric as N
>>>
>>> x = N.arange( 10. )
>>>
>>> print x
[ 0.  1.  2.  3.  4.  5.  6.  7.  8.  9.]
>>>
>>> for this_item in x :
...     print '%e' % this_item
...
0.000000e+000
1.000000e+000
2.000000e+000
3.000000e+000
4.000000e+000
5.000000e+000
6.000000e+000
7.000000e+000
8.000000e+000
9.000000e+000
>>>


-- 
Cousin Stanley
Human Being
Phoenix, Arizona






More information about the Python-list mailing list