Ask Your Question

How to copy code from Jupyter notebook

asked 2016-12-29 20:52:50 +0100

omoplata gravatar image

How do I copy code from a Jupyter notebook to paste it here? I cannot figure out a way to do it.

In the old sage notebook format you can get a text version of your code input output by clicking a 'text' button that is to the right of the 'worksheet' button. I find that very convenient when posting questions here.

But since Sage seems to be moving to the Jupyter notebook format from the old notebook format, I figured I better get used to the Jupyter notebook.

I'm running Sage in Virtualbox in Windows.

Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-01-01 18:26:22 +0100

omoplata gravatar image

updated 2017-01-01 18:27:18 +0100

OK, I found out that this can be done using the %history magic function. For example,

%history -n -o 12-17

prints the inputs 12 to 17 with output, and I can copy from that. But the error messages don't get printed.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2016-12-29 20:52:50 +0100

Seen: 5,429 times

Last updated: Jan 01 '17