First time here? Check out the FAQ!

Ask Your Question
1

How to copy code from Jupyter notebook

asked 8 years ago

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 8 years ago

omoplata gravatar image

updated 8 years ago

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.

Preview: (hide)
link

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 8 years ago

Seen: 5,777 times

Last updated: Jan 01 '17