Last active
September 25, 2017 18:29
-
-
Save DGrady/cc85545b0128118b1660b52c25bb3ba1 to your computer and use it in GitHub Desktop.
A Python script to remove input cells from a Jupyter-notebook-generated HTML file
This file contains 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
""" | |
Remove the input cells from an HTML document generated from a Jupyter notebook | |
Reads from either STDIN or the named file, and writes to STDOUT | |
""" | |
import fileinput | |
from bs4 import BeautifulSoup | |
text = "".join(fileinput.input()) | |
doc = BeautifulSoup(text, 'html.parser') | |
[x.extract() for x in doc.select('div.input')] | |
print(str(doc)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment