%paste
This is the primary Magic Method for pasting. It directly pastes text from the system clipboard, intelligently handling common issues with newlines and indentation.
%cpaste
If you are using IPython via SSH, use %cpaste
instead, as it does not need to access the remote system clipboard.
Since IPython 5.0.0, the improved prompt toolkit should directly handle pasting multi-line code without the need for %paste
or %cpaste
.