How to print floating point in scientific format?

sdhyok sdhyok at yahoo.com
Sun Aug 10 21:25:24 CEST 2003


"Andrew Dalke" <adalke at mindspring.com> wrote in message news:<bh3g5c$f4m$1 at slb5.atl.mindspring.net>...
> Python gives complete control over you can represent numbers.
> It just doesn't change the default representation.  Users *can*
> flexibly modify the printing format.
> 
> I can't see why you would want to change it globally.  That
> just sounds wrong.  Eg, I want my app to print the resolution
> in Angstroms in the form "%3.2f" while I want the mass values
> in "%3.1f".  A global setting is a very clumsy way to change that.

Andrew, I take your advice.
To change the format of floating point globally
may be too aggressive.
But, still I think we need more elegant way to print out floating point arrays
in python.

What is your best way for my example?
(I hope it is not for loop.)

Daehyok Shin




More information about the Python-list mailing list