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
import json | |
import os | |
#Define path of Jupyter notebook File: | |
notebook_path = r"c:\Users\Pat\Test.ipynb" | |
#Read in notebook as JSON and delete all output cells: | |
with open(notebook_path, "r") as f: | |
nb = json.load(f) | |
for i, cell in enumerate(nb["cells"]): |
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
def iterate_all(iterable, returned="key"): | |
"""Returns an iterator that returns all keys or values | |
of a (nested) iterable. | |
Arguments: | |
- iterable: <list> or <dictionary> | |
- returned: <string> "key" or "value" | |
Returns: |