HEX
Server: Apache
System: Linux andromeda.lojoweb.com 4.18.0-372.26.1.el8_6.x86_64 #1 SMP Tue Sep 13 06:07:14 EDT 2022 x86_64
User: nakedfoamlojoweb (1056)
PHP: 8.0.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/thread-self/root/usr/share/doc/python3-pexpect/doc/api/replwrap.rst
replwrap - Control read-eval-print-loops
========================================

.. automodule:: pexpect.replwrap

.. versionadded:: 3.3

.. autoclass:: REPLWrapper

   .. automethod:: run_command

.. data:: PEXPECT_PROMPT

   A string that can be used as a prompt, and is unlikely to be found in output.

Using the objects above, it is easy to wrap a REPL. For instance, to use a
Python shell::

    py = REPLWrapper("python", ">>> ", "import sys; sys.ps1={!r}; sys.ps2={!r}")
    py.run_command("4+7")

Convenience functions are provided for Python and bash shells:

.. autofunction:: python

.. autofunction:: bash