Python termios Module
Example
Get terminal attributes (Unix only):
import termios
import sys
attrs = termios.tcgetattr(sys.stdin)
print(f'Terminal attributes retrieved')
print(f'Number of attributes: {len(attrs)}')
Try it Yourself »
Definition and Usage
The termios module provides POSIX-style terminal control for Unix systems.
Use it to manipulate terminal settings like echo, buffering, or special characters for terminal applications.
Note: This module is only available on Unix systems.
Members
Member | Description |
---|---|
error | Exception raised for termios-specific errors. |
tcdrain() | Wait until all output has been transmitted. |
tcflow() | Suspend or resume input/output. |
tcflush() | Discard queued data. |
tcgetattr() | Get terminal attributes. |
tcsendbreak() | Send a break signal. |
tcsetattr() | Set terminal attributes. |