forked from kamo/post-it-contents
count utils
parent
15ba803cdc
commit
0c67b28cca
@ -0,0 +1,82 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Nim Fanfic: 73\n",
|
||||
"What is a loot box?: 158\n",
|
||||
"One-sentence game ideas: 98\n",
|
||||
"Miriam the Leader: 32\n",
|
||||
"Katamari Fanfic: 147\n",
|
||||
"there are 2 types of treasure chest: 24\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Total post-it: 532\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import frontmatter\n",
|
||||
"import os\n",
|
||||
"\n",
|
||||
"# list all the folders\n",
|
||||
"folders = [ name for name in os.listdir() if os.path.isdir(os.path.join('', name)) and not name.startswith('.') ]\n",
|
||||
"\n",
|
||||
"total = 0\n",
|
||||
"for folder in folders:\n",
|
||||
" with open(f'{folder}/contents.md', 'r') as f:\n",
|
||||
" metadata, body = frontmatter.parse(f.read())\n",
|
||||
" block = len(metadata['contents'])\n",
|
||||
" print(f'{metadata[\"title\"]}: {block}')\n",
|
||||
" total = total + block\n",
|
||||
"print('\\n')\n",
|
||||
"print(f'Total post-it: {total}')\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"interpreter": {
|
||||
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
|
||||
},
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3.8.2 64-bit",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.2"
|
||||
},
|
||||
"orig_nbformat": 4
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
Loading…
Reference in New Issue