Preview:
# This IPython Notebook magic writes the content of the cell to a specified .py 
# file before executing it. An identifier can be used when writing to the file,
# thus making it possible to overwrite previous iterations of the same code block.
# The use case for this extension is to export selected code from a Notebook for 
# reuse through a .py file.

%install_ext https://raw.githubusercontent.com/minrk/ipython_extensions/master/extensions/writeandexecute.py


# Then load it with

%load_ext writeandexecute
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter