On this page
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
- Pass
exitmsg=""for silent exit when the user pressesCtrl-D.
REPL Inspect
from code import interact
help(interact)
Linked from
Related notes
- tuts/python3/stdlib_module/code/compile_command Linked here; links to this page; shared tags: #code, #stdlib
- tuts/python3/stdlib_module/code/InteractiveConsole Linked here; links to this page; shared tags: #code, #stdlib
- tuts/python3/stdlib_module/code/InteractiveInterpreter Linked here; links to this page; shared tags: #code, #stdlib
- tuts/python3/stdlib_module/code Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib