Skip to content

Commit c79a8d3

Browse files
committed
workbook 자동화
1 parent eaa963d commit c79a8d3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

workbook/actions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def get_problem_info(workbook_url):
2525
ret = []
2626
while True:
2727
x = txt.find(pattern)
28-
print(x)
2928
if x == -1: break
3029
txt = txt[x+9:]
3130
prob_id, prob_name = '', ''
@@ -64,8 +63,9 @@ def gen_ind_workbook(attrs, category):
6463
category_idx = category[chapter_idx].index(prob_id)
6564
file_path = solution_path + prob_id
6665
if not os.path.exists(file_path + '.java'):
67-
with open(file_path + '.java', 'w', encoding="UTF-8") as f:
68-
f.write(txt)
66+
os.makedirs(os.path.dirname(file_path), exist_ok=True) # 디렉토리 없으면 생성
67+
with open(file_path + '.java', 'w', encoding="UTF-8") as f:
68+
f.write(txt)
6969
try:
7070
codes = open(file_path + '.java', 'r', encoding="UTF-8").read()
7171
except: # EUC-KR -> UTF-8

0 commit comments

Comments
 (0)