How to print floating point in scientific format?
sdhyok at yahoo.com
Mon Aug 11 05:41:35 CEST 2003
Writing my own function is definitely one choice.
But, my point is that if some of us are really serious
about scientific/engineering programming,
we must have a common function or command
to print out whole array elements easily with any format we want.
It can be in Numeric (or numarray) package like,
import Numeric as N
bokr at oz.net (Bengt Richter) wrote in message news:<bh6bq6$p1u$0 at 188.8.131.52>...
> On 8 Aug 2003 12:15:53 -0700, sdhyok at yahoo.com (sdhyok) wrote:
> >I want to change the DEFAULT behavior of python
> >to print out all floating points in scientific format?
> >For instance,
> >>print x
> >1.000000E-2 #Like print "%E"%x
> >How can I do it?
> Do you have to use the print statement per se for output?
> I.e., why couldn't you write
> sciPrint( x, whatever, etc )
> instead of
> print x, whatever, etc
> Then you could customize sciPrint as you please.
> Or do you have to change the behaviour of existing modules without
> changing their source?
> Bengt Richter
More information about the Python-list