On this page
  1. code.interact
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

code.interact

Prev: code.compile_command | Up: code | Next: code.InteractiveConsole
Rel: code.compile_command, code.InteractiveConsole, code.InteractiveInterpreter
Ref: docs.python.org — code.interact
Tags: #public #python3 #stdlib #code


Import

import code
from code import interact

Signature & Overview

code.interact(banner=None, readfunc=None, local=None, exitmsg=None, local_exit=False)

Closely emulate the interactive Python interpreter.

Usage

import code

# Starts an interactive REPL with the given locals dict:
# code.interact(banner="Debug shell", local=locals())
assert callable(code.interact)

Gotchas

REPL Inspect

from code import interact
help(interact)

Linked from

Related notes