18

Possible Duplicate:
How to save a Python interactive session?

Is it possible, and if so, how do I save the code that I have written in an IPython session?

Optimally I would only output the code that runs without errors, but exporting all the code would go a long way as well, I suppose.

Community
  • 1
  • 1
Samuel Lampa
  • 4,256
  • 4
  • 40
  • 63

1 Answers1

27

%save my_useful_session 10-20 23

to save input lines 10 to 20 and 23 to my_useful_session.py

Boris Verkhovskiy
  • 10,733
  • 7
  • 77
  • 79
Samuel Lampa
  • 4,256
  • 4
  • 40
  • 63
  • 2
    Try `save?` to see how to use it. You can also use `lsmagic` to see the available magic commands. – Thomas K Nov 29 '12 at 17:37