diff --git a/工具v2/database_tools.py b/工具v2/database_tools.py index 0539a7dd..e3082bbb 100644 --- a/工具v2/database_tools.py +++ b/工具v2/database_tools.py @@ -2022,5 +2022,23 @@ def ExportIDList(filepath): #从.tex或.pdf文件获取题目序号和ID的对 output += ",".join(currentoutput)+"\n\n" return output +def makedir(dirpath): #递归创建文件夹 + dirpath = dirpath.strip().replace("\\","/") + dirlist_raw = dirpath.split("/") + if ":" in dirlist_raw[0]: + dirlist_raw[1] = dirlist_raw[0] + "/" + dirlist_raw[1] + dirlist = dirlist_raw[1:].copy() + else: + dirlist = dirlist_raw.copy() + for i in range(len(dirlist)): + if not i == 0: + dirlist[i] = dirlist[i-1] + "/" + dirlist[i] + for dpath in dirlist: + try: + os.mkdir(dpath) + except: + pass + return dirlist + if __name__ == "__main__": print("数据库工具, import用.") \ No newline at end of file