已有工具v2的脚本中的os.mkdir()均改为makedir()

This commit is contained in:
weiye.wang 2024-02-21 21:00:02 +08:00
parent 58ec422bb1
commit 5c0f92a64e
3 changed files with 4 additions and 6 deletions

View File

@ -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 #返回文件名

View File

@ -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")

View File

@ -17,9 +17,9 @@ answersheetseekingpath = "../备课组"
try:
shutil.rmtree(tempdir)
os.mkdir(tempdir)
except:
pass
makedir(tempdir)