markk
markk

Reputation: 737

ipython notebook save variables after closing

After you close the ipython notebook, I realized all the code is there but the namespace has been reset, as in all of the variables I had were gone. Is there a way I could save the variables so that when I turn ipython notebook back on, the variables are all there without rerunning the code?

Upvotes: 5

Views: 7018

Answers (1)

Robert Jacobs
Robert Jacobs

Reputation: 3340

Use the storemagic command.
http://ipython.org/ipython-doc/rel-0.12/config/extensions/storemagic.html

In [1]: l = ['hello',10,'world']
In [2]: %store l
In [3]: exit

(IPython session is closed and started again...)

ville@badger:~$ ipython
In [1]: l
Out[1]: ['hello', 10, 'world']

Upvotes: 4

Related Questions