1
0
Fork 0
mirror of https://github.com/satwikkansal/wtfpython synced 2025-07-04 20:38:06 +02:00

Update backslash example

This commit is contained in:
Satwik Kansal 2018-01-17 19:23:13 +05:30
parent ca78a6d483
commit e2e8e42d52
2 changed files with 19 additions and 36 deletions

View file

@ -1,31 +0,0 @@
import pprint
fname = "README.md"
snipepts = []
with open(fname, 'r') as f:
lines = f.readlines()
for line in lines:
# check if it's a H3
if line.startswith("###"):
title = line.replace("### ", "")
# get Title, des
# store lines till an H4 (explanation) is encountered
# store lines again until --- or another H3 is encountered
snippets.append({
"title":,
"description":,
"explanation":
})
# repeat until EOL is encoutered
# separating by category
categories = ["a", "b", "c"]
snips_by_cat = {k:[] for k in categories}
for snip in snippets:
cat = raw_input(snip["title"])
snips_by_cat[cat].append(snip)
pprint.pprint(snips_by_cat)