From 311db87ad6495cfd414bab45b7dd8cfbbd0155d1 Mon Sep 17 00:00:00 2001 From: wangweiye7840 Date: Sun, 2 Jul 2023 19:11:49 +0800 Subject: [PATCH] =?UTF-8?q?GetValidTexFiles=E5=87=BD=E6=95=B0=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=88=97=E8=A1=A8=E6=8E=92=E5=BA=8F=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 工具v2/database_tools.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/工具v2/database_tools.py b/工具v2/database_tools.py index 69174997..e5b3515d 100644 --- a/工具v2/database_tools.py +++ b/工具v2/database_tools.py @@ -782,7 +782,7 @@ def GenerateTeacherBodyString(problems,sectiontitles,prodict,objdict,consecutive bodystring += sectionstring return bodystring #返回主题内容字符串 -def GetValidTexFiles(path): #获取有题号的.tex文件列表 及 有题号的.tex文件所在的路径列表 +def GetValidTexFiles(path): #获取 有题号的.tex文件列表 及 有题号的.tex文件所在的路径列表 texlist = [] pathlist = [] for root,folders,files in os.walk(path): @@ -793,9 +793,10 @@ def GetValidTexFiles(path): #获取有题号的.tex文件列表 及 有题号的 if len(ids) > 0: pathlist = pathlist + [root] texlist = texlist + [os.path.join(root,file)] - texlist = list(set(texlist)) - pathlist = list(set(pathlist)) + texlist = sorted(list(set(texlist))) + pathlist = sorted(list(set(pathlist))) return (texlist,pathlist) # 返回 有题号的.tex文件列表 与 所在路径列表 组成的二元组 + if __name__ == "__main__": print("数据库工具, import用.") \ No newline at end of file