Is there a way in python to programmatically determine the width of the console? I mean the number of characters that fits in one line without wrapping, not the pixel width
Starting at Python 3.3 it is straight forward: https://docs.python.org/3/library/os.html#querying-the-size-of-a-terminal
>>> import os >>> ts = os.get_terminal_size() >>> ts.lines 24 >>> ts.columns 80