Created
September 10, 2020 16:37
-
-
Save EricSchles/f86b874c3840a6619aff0c5752c114c0 to your computer and use it in GitHub Desktop.
count the number of lines in your jupyter notebooks
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
from glob import glob | |
from json import load | |
def loc(nb): | |
cells = load(open(nb))["cells"] | |
return sum(len(c["source"]) for c in cells) | |
root_folder = "~" | |
summation = 0 | |
for File in glob(root_folder+"/**/*.ipynb", recursive=True): | |
summation += loc(File) | |
print(summation) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment