16.

16.1.

REPL line control capabilities

Python 3.13 shell shell Controlling color F1 pydocF2 >>> ... F3 F3

shell exit quit shell

shell PYTHON_BASIC_REPL

16.1.1.

(nonzero exit status) ( except try )

Control-C Delete [1] KeyboardInterrupt try

16.1.2. Python

BSD Unix Python shell

#!/usr/bin/env python3

PATH #! Unix ('\n') Windows ('\r\n') '#' Python

chmod

$ chmod +x myscript.py

Windows Python .py python.exe Python .pyw

16.1.3.

Python PYTHONSTARTUP Unix shell .profile

Python /dev/tty import sys.ps1 sys.ps2

if os.path.isfile('.pythonrc.py'): exec(open('.pythonrc.py').read())

import os
filename = os.environ.get('PYTHONSTARTUP')
if filename and os.path.isfile(filename):
    with open(filename) as fobj:
        startup_file = fobj.read()
    exec(startup_file)

16.1.4.

Python (hook) sitecustomize usercustomize site-packages Python

>>> import site
>>> site.getusersitepackages()
'/home/user/.local/lib/python3.x/site-packages'

usercustomize.py Python -s import

sitecustomize site-packages usercustomize import site

[1]

GNU Readline