Skip to main content

Python REPL Guide

Beginner Satellite

Python REPL

The Read-Eval-Print Loop (REPL) is your scratchpad. Learn hotkeys, helper functions, and productivity tips.

Launch

python
# or
python -i script.py # run script then stay in REPL

Use exit() or Ctrl+D (Ctrl+Z on Windows) to leave.

Useful helpers

HelperDescription
help(obj)Opens documentation on any object
dir(obj)Lists attributes/methods
_Stores last returned value
import thisZen of Python

Productivity tips

Python 3.13+ ships a new interactive shell with multiline editing, colored prompts, and better completion out of the box — the readline advice below applies mainly to older versions.

  • Enable tab completion by installing readline (pip install gnureadline on macOS).
  • Use IPython for richer history, magics, and syntax highlighting.
  • Recall previous commands with arrow keys or Ctrl+R.

Next up in your learning path