1

So, I know I can export an ipython session to a notebook, and then convert that notebook to many format using jupyter nbconvert ....

However, the doc also says I should be able to export the session directly to a python script if I give the filename a .py extension. That doesn't work, it still generates a notebook json file.

Can I get the desired behavior in some way?

Thanks.

Thomas K
  • 39,200
  • 7
  • 84
  • 86
Charles Langlois
  • 4,198
  • 4
  • 16
  • 25
  • 1
    The doc in this case is wrong (it's fixed in [the dev version](http://ipython.readthedocs.io/en/latest/interactive/magics.html?highlight=magic#magic-notebook)). You can use `%history -f foo.py` to save the current session to a Python file. [%history docs](http://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-history). – Thomas K Oct 18 '16 at 09:08

1 Answers1

1

The answer was, as Thomas K. said, use %history -f ... instead...

SiHa
  • 7,830
  • 13
  • 34
  • 43
Charles Langlois
  • 4,198
  • 4
  • 16
  • 25