bundles / IPython 9.13.0 / IPython / core / inputtransformer2 / PromptStripper
class
IPython.core.inputtransformer2:PromptStripper
Signature
class PromptStripper ( prompt_re , initial_re = None , * , doctest = False ) Members
Summary
Remove matching input prompts from a block of input.
Parameters
prompt_re: regular expressionA regular expression matching any input prompt (including continuation, e.g.
...)initial_re: regular expression, optionalA 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