os.get_terminal_size(fd=STDOUT_FILENO)
Return the size of the terminal window as (columns, lines)
, tuple of type terminal_size
.
The optional argument fd
(default STDOUT_FILENO
, or standard output) specifies which file descriptor should be queried.
If the file descriptor is not connected to a terminal, an OSError
is raised.
shutil.get_terminal_size()
is the high-level function which should normally be used, os.get_terminal_size
is the low-level implementation.
Availability: Unix, Windows.
Please login to continue.