termios

The termios module provides a POSIX-style interface for controlling the behavior of TTYs and other serial communication devices on UNIX systems. All the functions operate on integer file descriptors such as those returned by the os.open() function or the fileno() method of a file object. In addition, the module relies on a large collection of constants that are also defined in this module.

tcgetattr(fd)

Returns a list [iflag, oflag, cflag, lflag, ispeed, ospeed, cc] of TTY attributes for a file descriptor, fd. The meaning of these fields is as follows:

FieldDescription
iflagInput modes (integer)
oflagOutput modes (integer)
cflagControl modes (integer)
lflagLocal modes (integer)
ispeedInput speed (integer)
ospeedOutput speed (integer)
ccA list ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.