PDA

View Full Version : Python: printing arrays formats



nbo10
May 26th, 2010, 11:24 AM
Hi all,
I have numpy arrays that I want to print across the terminal CL. No matter how wide I make the terminal the array only print 4-5 doubles and then starts a new line. Is there any way to control the print format? I've looked into numoy.set_printoptions, but that doesn't seem to help. thanks

ssam
May 26th, 2010, 02:10 PM
playing with


numpy.set_printoptions(linewidth=1e6, edgeitems=1e6)

seems to do the job.

another option is to just do it yourself. for a 2d array:


for line in my_array:
for element in line:
print element,
print