get_terminal_size get columns code example
Example 1: get_terminal_sizee python
from os import get_terminal_size
size = get_terminal_size() # Columns, Lines
Example 2: python console width
import os
rows, columns = os.popen('stty size', 'r').read().split()