it fucking works

2020
Dawid J. Kubis 5 years ago
parent 1b03b68377
commit 69cf386e77

@ -3,21 +3,41 @@
Učí profesor Kubis a docent Veškrna.
## 1
+ [bool_vyrazy](./1/bool_vyrazy)
...
+ [bool_vyrazy](1/bool_vyrazy)
+ [datove_typy](1/datove_typy)
+ [if](1/if)
+ [interpretace](1/interpretace)
+ [komentare](1/komentare)
+ [operace](1/operace)
+ [promenne](1/promenne)
+ [python_interpreter](1/python_interpreter)
+ [zakladni_funkce](1/zakladni_funkce)
## 2
+ [while](2/while)
## 3
## 4
+ [for](3/for)
+ [funkce](3/funkce)
+ [range](3/range)
+ [seznam](3/seznam)
## 5
+ [README](5/README)
## 6
+ [README](6/README)
## 7
+ [README](7/README)
## 8
+ [dict](8/dict)
+ [importy](8/importy)
+ [list_comprehensions](8/list_comprehensions)
+ [requests_and_http](8/requests_and_http)
+ [tenary_operator](8/tenary_operator)
## 9
+ [README](9/README)

@ -1,6 +1,7 @@
#!/usr/bin/python
import os
from functools import reduce
PREFIX = '''# python-gjk
@ -23,8 +24,29 @@ def get_mds(path):
def mkformat(files):
result = []
files = [list(os.path.split(i)) for i in files]
files = path_dict(files)
for key in files:
result.append(f'## {key}')
for name in sorted(files[key]):
result.append(f'+ [{name}]({os.path.join(key, name)})')
result.append('')
return result
def path_dict(files):
di = dict()
for x, y in files:
if not di.get(x):
di[x] = []
di[x].append(y)
return di
files = sorted([i[2:] for i in get_mds('.') if i != './README'])
files = [i for i in get_mds('.') if i != './README']
with open('README.md', 'w') as f:
f.writelines(PREFIX + mkformat(files))
to_write = PREFIX + mkformat(files)
to_write = [i + '\n' for i in to_write]
f.writelines(to_write)

Loading…
Cancel
Save