Created
February 27, 2014 14:53
-
-
Save inducer/9251587 to your computer and use it in GitHub Desktop.
Script to remove output in IPython notebook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
from json import load, dump | |
import sys | |
if len(sys.argv) != 3: | |
print("usage: %s INFILE OUTFILE", file=sys.stderr) | |
with open(sys.argv[1], "rt") as inf: | |
ipynb = load(inf) | |
for ws in ipynb["worksheets"]: | |
for cell in ws["cells"]: | |
cell["outputs"] = [] | |
with open(sys.argv[2], "wt") as outf: | |
dump(ipynb, outf) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Perfect, Thank you!