Terminal Interface Modules

readline

Provides interactive line editing, completion and history support through GNU readline or libedit on supported Unix builds. Settings and history can affect the interpreter session; do not load untrusted configuration or persist secrets. The backend attribute added in 3.13 identifies the implementation. The example changes no settings.

Formal Syntax & Structure

python syntaxpython
import readline

Return Value

module

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

Working Example

Example Snippetpython
import readlineprint(readline.backend in ("readline", "editline"))
Python Reference