Terminal Interface Modules

pty

Unix pseudo-terminal helpers for creating a master/slave terminal pair or interacting with terminal-oriented child programs. Pseudo-terminals differ from ordinary pipes because they can provide terminal semantics. Child and descriptor lifetimes need cleanup. The example inspects interfaces without starting a child or changing terminal settings.

Formal Syntax & Structure

python syntaxpython
import pty

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
import ptyprint(callable(pty.openpty), callable(pty.spawn))
Python Reference