Note, my question is specifically about Jupyter Notebooks. In addition, I don't just want to run the code, like you can get in the ipython console with %paste
. I want to paste the code snippet into a cell and edit it before running. (So this is not a duplicate of either this question or this one.)
A lot of example snippets in pandas and seaborn documentation have a form like:
>>> import pandas as pd
>>> df = pd.DataFrame({'A': {0: 'a', 1: 'b', 2: 'c'},
... 'B': {0: 1, 1: 3, 2: 5},
... 'C': {0: 2, 1: 4, 2: 6}})
>>> df
To get rid of the '>>>' and '...', I currently paste snippets into a Sublime Text editor, use the multiple cursor to properly format the code, and then paste it into the notebook cell.
Is there a more efficient way to do this and if so, what is it?