Search code examples
pythonpython-3.xshellunixformatting

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.


Solution

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

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