On this page
  1. os.terminal_size
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

os.terminal_size

Prev: os.system | Up: os | Next: os.times_result
Rel: os.abort, os.access, os.chdir, os.chmod
Ref: docs.python.org โ€” os.terminal_size
Tags: #public #python3 #stdlib #os


Import

import os
from os import terminal_size

Signature & Overview

os.terminal_size(iterable=(), /)

A tuple of (columns, lines) for holding terminal window size

Methods & Attributes

Usage

import os
import shutil

sz = shutil.get_terminal_size((80, 24))
assert isinstance(sz, os.terminal_size) and sz.columns > 0 and sz.lines > 0

Gotchas

REPL Inspect

from os import terminal_size
help(terminal_size)

Linked from

Related notes