Ask Your Question

Revision history [back]

If your worksheet is written in ipython/jupyter, you can do:

sage -ipython nbconvert --to script <your_worksheet>.ipynb

If your worksheet is written in sage_notebook, you can do:

sage -sws2rst <your_worksheet>.sws

In both cases, you will get some text file that is not exactly a python file, but from which it is easy to remove the few additional stiff to get a python file.

If your worksheet is written in ipython/jupyter, you can do:

sage -ipython nbconvert --to script <your_worksheet>.ipynb

If your worksheet is written in sage_notebook, you can do:

sage -sws2rst <your_worksheet>.sws

In both cases, you will get some text file that is not exactly a python file, but from which it is easy to remove the very few additional stiff stuff to get a python file.