mar*_*rkk 5 python ipython jupyter-notebook
关闭 ipython 笔记本后,我意识到所有代码都在那里,但名称空间已被重置,因为我拥有的所有变量都消失了。有没有办法可以保存变量,以便当我重新打开 ipython 笔记本时,变量都在那里,而无需重新运行代码?
使用 storemagic 命令。
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']
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6753 次 |
| 最近记录: |