Print precision?

Damian Menscher menscher+python at uiuc.edu
Thu May 23 23:33:26 EDT 2002


I'm debugging my program that depends on the Numeric/LinearAlgebra
packages.  In order to get an idea of what is going on, I just use
lots of print statements.  But when you're printing a largish
(32x32) matrix, the 8 decimal places given by default can take
more space than they're worth.  Is there a simple way to cut this
down to a more reasonable value (like zero)?

I guess I *could* write a function that prints each element
separately....
for i in range(32):
	print "%.1f %.1f %.1f %.1f ..."%(m[i,0], m[i,1], m[i,2]....)
But that just seems silly.


On a related note, is there a way to change the default line width?
Even if I expand my xterm to 200+ chars, Python wraps the matrix
output at 80.

Damian Menscher
-- 
-=#| Physics Grad Student & SysAdmin @ U Illinois Urbana-Champaign |#=-
-=#| 488 LLP, 1110 W. Green St, Urbana, IL 61801 Ofc:(217)333-0038 |#=-
-=#| 1429 DCL, Workstation Services Group, CITES Ofc:(217)244-3862 |#=-
-=#| <menscher at uiuc.edu> www.uiuc.edu/~menscher/ Fax:(217)333-9819 |#=-



More information about the Python-list mailing list