We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 491a98e commit ca78a6dCopy full SHA for ca78a6d
parse_readme.py
@@ -0,0 +1,31 @@
1
+import pprint
2
+
3
+fname = "README.md"
4
+snipepts = []
5
6
+with open(fname, 'r') as f:
7
+ lines = f.readlines()
8
+ for line in lines:
9
+ # check if it's a H3
10
+ if line.startswith("###"):
11
+ title = line.replace("### ", "")
12
+ # get Title, des
13
+ # store lines till an H4 (explanation) is encountered
14
+ # store lines again until --- or another H3 is encountered
15
+ snippets.append({
16
+ "title":,
17
+ "description":,
18
+ "explanation":
19
+ })
20
+ # repeat until EOL is encoutered
21
22
+# separating by category
23
+categories = ["a", "b", "c"]
24
25
+snips_by_cat = {k:[] for k in categories}
26
27
+for snip in snippets:
28
+ cat = raw_input(snip["title"])
29
+ snips_by_cat[cat].append(snip)
30
31
+pprint.pprint(snips_by_cat)
0 commit comments