all Python 3systerm
sys
module
The interpreter's own state: command-line arguments, standard streams, import paths, version, exit.
Syntax
import sys
sys answers about the interpreter itself: sys.argv, sys.path, sys.modules, sys.version_info, the stdin/stdout/stderr streams and sys.exit. Questions about the operating system — environment variables, files, processes — belong to os, not sys. Common mistakes: comparing the sys.version string instead of the sys.version_info tuple, and expecting sys.exit to bypass finally — it only raises SystemExit.
Examples
import sys
print(sys.version_info >= (3, 0)) # → True
print(sys.platform) # → ? linux, win32 или darwin
print(type(sys.argv).__name__) # → list
See also
Open in the full glossarydocs.python.orgReport an inaccuracy