Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
skill_tree_dailycode
提交
e9a8f5d6
S
skill_tree_dailycode
项目概览
CSDN 技术社区
/
skill_tree_dailycode
通知
11
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
2
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
skill_tree_dailycode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
2
Issue
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
e9a8f5d6
编写于
12月 10, 2021
作者:
每日一练社区
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化it冷知识处理
上级
95a55df3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
48 addition
and
1 deletion
+48
-1
it_knowledge_helper.py
it_knowledge_helper.py
+48
-1
未找到文件。
it_knowledge_helper.py
浏览文件 @
e9a8f5d6
...
...
@@ -228,11 +228,58 @@ def update_it_konwledge():
continue
else
:
choice_list_remove
.
append
(
val
)
solution_md_data
=
f
"#
{
question_title
}
\n\n
{
question_content
}
\n\n
## 答案
\n\n
```
{
language
}
\n
{
answer
}
\n
```
\n\n
## 选项
\n\n
### A
\n\n
```
{
language
}
\n
{
choice_list_remove
[
0
]
}
\n
```
\n\n
### B
\n\n
```
{
language
}
\n
{
choice_list_remove
[
1
]
}
\n
```
\n\n
### C
\n\n
```
{
language
}
\n
{
choice_list_remove
[
2
]
}
\n
```"
if
file
in
exist_files
:
save_path
=
it_mapping
[
file
]
s
olution_md_data
=
f
"#
{
question_title
}
\n\n
{
question_content
}
\n\n
## 答案
\n\n
```
{
language
}
\n
{
answer
}
\n
```
\n\n
## 选项
\n\n
### A
\n\n
```
{
language
}
\n
{
choice_list_remove
[
0
]
}
\n
```
\n\n
### B
\n\n
```
{
language
}
\n
{
choice_list_remove
[
1
]
}
\n
```
\n\n
### C
\n\n
```
{
language
}
\n
{
choice_list_remove
[
2
]
}
\n
```"
s
lution_path
=
os
.
path
.
join
(
'/'
.
join
(
save_path
.
split
(
'/'
)[:
-
1
]),
'solution.json'
)
with
open
(
save_path
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
f
.
write
(
solution_md_data
)
solution_data
=
load_json
(
slution_path
)
solution_data
[
'keywords'
]
=
keywords
solution_data
[
'topic_link'
]
=
topic_link
dump_json
(
slution_path
,
solution_data
)
else
:
save_dir
=
'data/1.dailycode初阶/4.it_knowledge'
dir_list_
=
os
.
listdir
(
save_dir
)
dir_list
=
[]
for
i
in
dir_list_
:
current_dst_dir_
=
os
.
path
.
join
(
save_dir
,
i
)
if
os
.
path
.
isdir
(
current_dst_dir_
):
dir_list
.
append
(
current_dst_dir_
)
number
=
len
(
dir_list
)
+
1
dst_dir
=
os
.
path
.
join
(
save_dir
,
str
(
number
)
+
'.exercises'
)
if
not
os
.
path
.
exists
(
dst_dir
):
os
.
mkdir
(
dst_dir
)
config_data
=
{}
config_data
[
'node_id'
]
=
'dailycode-'
+
uuid
.
uuid4
().
hex
config_data
[
'keywords'
]
=
[]
config_data
[
'children'
]
=
[]
config_data
[
'export'
]
=
[
"solution.json"
]
solution_json_data
=
{}
solution_json_data
[
'type'
]
=
'code_options'
solution_json_data
[
'author'
]
=
'Byeweiyang'
solution_json_data
[
'source'
]
=
'solution.md'
solution_json_data
[
'exercise_id'
]
=
uuid
.
uuid4
().
hex
solution_json_data
[
'keywords'
]
=
keywords
solution_json_data
[
'topic_link'
]
=
topic_link
solution_json_path
=
os
.
path
.
join
(
dst_dir
,
'solution.json'
)
solution_md_path
=
os
.
path
.
join
(
dst_dir
,
'solution.md'
)
config_path
=
os
.
path
.
join
(
dst_dir
,
'config.json'
)
dump_json
(
solution_json_path
,
solution_json_data
)
dump_json
(
config_path
,
config_data
)
with
open
(
solution_md_path
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
f
.
write
(
solution_md_data
)
it_mapping
[
file
]
=
solution_md_path
dump_json
(
it_mapping_path
,
it_mapping
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录