blob: f9c17511713ffacf19a2bf4bab75ccf923d6cca2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import json
import os
import re
class info:
notebook = ''
examples = []
notebooks = os.listdir('.')
notebooks = sorted(notebooks)
print notebooks
total = 0
for i in range(len(notebooks)):
ch_examples = 0
if notebooks[i].endswith(".ipynb"):
f = open(notebooks[i],'r')
data = json.load(f)
for dic in data["worksheets"][0]["cells"][0:]:
if "level" in dic and dic["level"] == 2:
ch_examples += 1
total += ch_examples
print i, " : " , ch_examples
print "Total Examples : " , total
|