Formatting numbers

Jack gambino at news.mondenet.com
Tue Sep 7 19:13:42 EDT 1999


I'm learning Python and the documentation is great,
but I haven't found an easy way to do the following.
Given an array (2-D) of numbers, I'd like to print 
them out nicely formatted. The numbers can differ
greatly in magnitude, so I'd like to use fewer
decimal places for big numbers than for large ones.

The output should look something like this (or better):

 123456.78   -0.000123   -54231.321
-4321567.1    9876.543    etc.

Someone somewhere must have written a module to do
this. Any pointers?

P.S. I want to use the Python interpreter only at
this time -- no tk or gtk.

Thanks.




More information about the Python-list mailing list