-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.py
67 lines (52 loc) · 1.79 KB
/
update.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python
import os
from urllib import parse
HEADER="""#
# 리트코드, 백준 문제 풀이 목록
git actions을 사용해 만들었습니다.
LeetCode에서는 TypeScript, 백준에서는 Python3을 이용해 풀이했습니다.
## 목차
- [🤔 Leetcode](#-leetcode)
- [🤔 백준](#-백준)
- [🚀 Bronze](#-Bronze)
- [🚀 Silver](#-Silver)
- [🚀 Gold](#-Gold)
- [🚀 Platinum](#-Platinum)
"""
def main():
content = ""
content += HEADER
directories = [];
solveds = [];
for root, dirs, files in os.walk("."):
dirs.sort()
if root == '.':
for dir in ('.git', '.github'):
try:
dirs.remove(dir)
except ValueError:
pass
continue
category = os.path.basename(root)
if category == 'images':
continue
directory = os.path.basename(os.path.dirname(root))
if directory == '.':
continue
if directory not in directories:
if directory in ["백준", "프로그래머스", "LeetCode"]:
content += "## 🤔 {}\n".format(directory)
else:
content += "### 🚀 {}\n".format(directory)
content += "| 문제번호 | 링크 |\n"
content += "| ----- | ----- |\n"
directories.append(directory)
for file in files:
if category not in solveds:
content += "|{}|[링크]({})|\n".format(category, parse.quote(os.path.join(root, file)))
solveds.append(category)
print("category : " + category)
with open("README.md", "w") as fd:
fd.write(content)
if __name__ == "__main__":
main()