diff --git a/工具v2/database_tools.py b/工具v2/database_tools.py index e3082bbb..3ba40654 100644 --- a/工具v2/database_tools.py +++ b/工具v2/database_tools.py @@ -19,7 +19,7 @@ def ReadTextFile(filepath): #读取文本格式的文件 def SaveTextFile(data,filepath): #写入文本格式的文件 pathname = os.path.dirname(filepath) if not os.path.exists(pathname): - os.mkdir(pathname) + makedir(pathname) with open(filepath,"w",encoding="u8") as f: f.write(data) return filepath #返回文件名 diff --git a/工具v2/单一题目转成图片文件.py b/工具v2/单一题目转成图片文件.py index ba0d35b2..a8dced27 100644 --- a/工具v2/单一题目转成图片文件.py +++ b/工具v2/单一题目转成图片文件.py @@ -16,10 +16,8 @@ content = pro_dict[id.zfill(6)]["content"] latex_raw = ReadTextFile("模板文件/独立文件模板.txt") latexdata = StringSubstitute(r"<<待替换\d*>>",latex_raw,[content]) -try: - os.mkdir("临时文件/pics") -except: - pass +makedir("临时文件/pics") + SaveTextFile(latexdata,"临时文件/pics/temp.tex") os.system("xelatex -interaction=batchmode -output-directory=临时文件/pics temp.tex") diff --git a/工具v2/收集使用记录.py b/工具v2/收集使用记录.py index 895e016a..4bcbb385 100644 --- a/工具v2/收集使用记录.py +++ b/工具v2/收集使用记录.py @@ -17,9 +17,9 @@ answersheetseekingpath = "../备课组" try: shutil.rmtree(tempdir) - os.mkdir(tempdir) except: pass +makedir(tempdir)