summaryrefslogtreecommitdiff
path: root/TestContribution/exampleCount.py
diff options
context:
space:
mode:
authorhardythe12015-04-07 15:58:05 +0530
committerhardythe12015-04-07 15:58:05 +0530
commit92cca121f959c6616e3da431c1e2d23c4fa5e886 (patch)
tree205e68d0ce598ac5caca7de839a2934d746cce86 /TestContribution/exampleCount.py
parentb14c13fcc6bb6d01c468805d612acb353ec168ac (diff)
downloadPython-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.tar.gz
Python-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.tar.bz2
Python-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.zip
added books
Diffstat (limited to 'TestContribution/exampleCount.py')
-rwxr-xr-xTestContribution/exampleCount.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/TestContribution/exampleCount.py b/TestContribution/exampleCount.py
new file mode 100755
index 00000000..f9c17511
--- /dev/null
+++ b/TestContribution/exampleCount.py
@@ -0,0 +1,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