0

When printing a "long" list in python, it adds automatic line break if it gets too long. Is there any way to set this length to the maximal size of the terminal? in my case it uses not even the half width of the terminal, and this is pretty annoying when printing bigger matrices, since it becomes totaly unreadable.

lets say:

x = np.zeros((30,30))
print(x)
>>> 
[[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
  0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
  0. 0. 0. 0. 0. 0.]

so some entries of the first row are printed in the second line... This makes the data (in case of a matrix representation) very unreadable

atsteich
  • 74
  • 5
  • Possible duplicate of [How to print the full NumPy array, without truncation?](https://stackoverflow.com/questions/1987694/how-to-print-the-full-numpy-array-without-truncation) – tuomastik Apr 30 '19 at 09:33
  • No, the threshold in print_options sets how many numbers are printed, before some of them are no longer printed... doesn't change the position of a line-break... – atsteich May 02 '19 at 07:54

1 Answers1

0

I have overseen the option "linewidth" in np.set_printoptions() which is exactly what i need..

atsteich
  • 74
  • 5