You are viewing an older version (9.3.0). Go to latest (9.13.0)
{ } Raw JSON

bundles / IPython 9.3.0 / IPython / core / inputtransformer2 / PromptStripper

class

IPython.core.inputtransformer2:PromptStripper

source: /IPython/core/inputtransformer2.py :48

Signature

class   PromptStripper ( prompt_re initial_re = None )

Members

Summary

Remove matching input prompts from a block of input.

Parameters

prompt_re : regular expression

A regular expression matching any input prompt (including continuation, e.g. ...)

initial_re : regular expression, optional

A regular expression matching only the initial prompt, but not continuation. If no initial expression is given, prompt_re will be used everywhere. Used mainly for plain Python prompts (>>>), where the continuation prompt ... is a valid Python expression in Python 3, so shouldn't be stripped.

Notes

If initial_re and prompt_re differ, only initial_re will be tested against the first line. If any prompt is found on the first two lines, prompts will be stripped from the rest of the block.

Aliases

  • IPython.core.inputtransformer2.PromptStripper