OLD | NEW |
(Empty) | |
| 1 replwrap - Control read-eval-print-loops |
| 2 ======================================== |
| 3 |
| 4 .. automodule:: pexpect.replwrap |
| 5 |
| 6 .. versionadded:: 3.3 |
| 7 |
| 8 .. autoclass:: REPLWrapper |
| 9 |
| 10 .. automethod:: run_command |
| 11 |
| 12 .. data:: PEXPECT_PROMPT |
| 13 |
| 14 A string that can be used as a prompt, and is unlikely to be found in output. |
| 15 |
| 16 Using the objects above, it is easy to wrap a REPL. For instance, to use a |
| 17 Python shell:: |
| 18 |
| 19 py = REPLWrapper("python", ">>> ", "import sys; sys.ps1={!r}; sys.ps2={!r}") |
| 20 py.run_command("4+7") |
| 21 |
| 22 Convenience functions are provided for Python and bash shells: |
| 23 |
| 24 .. autofunction:: python |
| 25 |
| 26 .. autofunction:: bash |
OLD | NEW |