提交 f2b29a72 编写于 作者: 每日一练社区's avatar 每日一练社区

update code

上级 d6c5f45a
......@@ -431,6 +431,7 @@ def fix_bug():
def add_color_for_special_exercises():
count = 0
dirs = ['data/2.算法中阶', 'data/3.算法高阶', 'data/1.算法初阶']
exercises_ids = []
......@@ -452,7 +453,16 @@ def add_color_for_special_exercises():
for idx, tem_dir in enumerate(exercises_dirs):
config_path = os.path.join(tem_dir, 'config.json')
solution_md_path = os.path.join(tem_dir, 'solution.md')
count+=1
print(solution_md_path)
with open(solution_md_path, 'r', encoding='utf-8') as f:
solution_md_data = f.read()
if solution_md_data.find('<font color="red">错误</font>') == -1:
solution_md_data = solution_md_data.replace('错误', '<font color="red">错误</font>')
with open(solution_md_path, 'w', encoding='utf-8') as f:
f.write(solution_md_data)
print('当前已有 {} 道习题'.format(count))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册