IPython 8.4.0 Pypi GitHub Homepage
Other Docs
BackRef
paste(self, parameter_s='')

The text is pulled directly from the clipboard without user intervention and printed back on the screen before execution (unless the -q flag is given to force quiet mode).

The block is dedented prior to execution to enable execution of method definitions. '>' and '+' characters at the beginning of a line are ignored, to allow pasting directly from e-mails, diff files and doctests (the '...' continuation prompt is also stripped). The executed block is also assigned to variable named 'pasted_block' for later editing with '%edit pasted_block'.

You can also pass a variable name as an argument, e.g. '%paste foo'. This assigns the pasted block to variable 'foo' as string, without executing it (preceding >>> and + is still stripped).

Options:

-r: re-executes the block previously entered by cpaste.

-q: quiet mode: do not echo the pasted text back to the terminal.

IPython statements (magics, shell escapes) are not supported (yet).

Paste & execute a pre-formatted code block from clipboard.

See Also

cpaste

manually paste code into terminal until you mark its end.

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

IPython.terminal.magics.TerminalMagics.cpaste

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /IPython/terminal/magics.py#152
type: <class 'function'>
Commit: