Skip to content

Instantly share code, notes, and snippets.

@awesomebytes
awesomebytes / ipython_to_file.md
Created March 16, 2016 10:38
Save iPython session to a python file as code

Save an iPython session commands/code to a file

You must use the magic method %save:

In [1]: %save?
Type:       Magic function
String Form:<bound method CodeMagics.save of <IPython.core.magics.code.CodeMagics object at 0x7fb5d25bb1d0>>
Namespace:  IPython internal
File: /usr/lib/python2.7/dist-packages/IPython/core/magics/code.py