Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python terminal output width

My Python 3.5.2 output in the terminal (on a mac) is limited to a width of ca. 80px, even if I increase the size of the terminal window.

This narrow width causes a bunch of line breaks when outputting long arrays which is really a hassle. How do I tell python to use the full command line window width?

For the record, i am not seeing this problem in any other program, for instance my c++ output looks just fine.

like image 260
Faser Avatar asked Apr 20 '17 08:04

Faser


1 Answers

For numpy, it turns out you can enable the full output by setting

np.set_printoptions(suppress=True,linewidth=np.nan,threshold=np.nan).

like image 188
Faser Avatar answered Sep 21 '22 00:09

Faser