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

  • 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