问题
I would like to copy and paste data from a Jupyter notebook. As per the following example which includes the In and Out elements.
When trying to copy this data I am currently unable to select the In and Out elements as these are not contained in the cell data.
In [23]:
df.index.slice_indexer(start_remove, end_remove)
Out[23]:
slice(36, 85, None)
This image shows the In and Out elements as well as the cells. I want to copy and paste all of this.
回答1:
Less ugly hack:
You can do this in console of Inspection Tool:
$('div.prompt').removeClass('prompt')
And you don't have to refresh the page. You can carry on your coding with the prompt class removed from all the div elements. And you can select what you want at all times. But if you create new cells, you will have to run that again.
Ugly hack:
Steps:
- Right click on
In [number]in your browser and click on Inspect Element
You will see something like this:
`<div class="prompt input_prompt">In [18]:</div>`
Double click on class and remove the
promptclass from thedivelement. After removing it, it will look like this:<div class="input_prompt">In [18]:</div>Press Enter and close the inspection tool.
Now click and select from left of
IinIn []and drag your mouse inside the code block.Voila! You got what you wanted.
You can replace
promptback or just refresh the page.
来源:https://stackoverflow.com/questions/41520415/copy-data-from-jupyter-notebook