Skip to content

Instantly share code, notes, and snippets.

@varokas
Created February 25, 2020 14:38
Show Gist options
  • Save varokas/8f1c2301db57d8ee920418307bbd349e to your computer and use it in GitHub Desktop.
Save varokas/8f1c2301db57d8ee920418307bbd349e to your computer and use it in GitHub Desktop.
summary.py
#%%
from collections import Counter
with open("test.txt") as f:
txt = f.read()
start = txt.find("------") + 7
line_items = txt[start:].split("\n")
items = [x for x in line_items if x.startswith("-")]
cnt = Counter(items)
print("All: " + str(sum(cnt.values())))
for k,v in cnt.items():
print(k,v)%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment