From d683ad00ce22d85f7ad58a70caefa70e169fb1a4 Mon Sep 17 00:00:00 2001 From: "weiye.wang" Date: Sat, 13 Jan 2024 20:39:24 +0800 Subject: [PATCH] =?UTF-8?q?databasetools=E4=B8=AD=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E4=BB=8E=E5=AD=97=E5=85=B8=E4=B8=AD=E6=8F=90=E5=8F=96=E9=A2=98?= =?UTF-8?q?=E5=8F=B7=E7=9A=84=E5=8A=9F=E8=83=BDExtractProblemIDs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 工具v2/database_tools.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/工具v2/database_tools.py b/工具v2/database_tools.py index 085b4e9f..6934bcb0 100644 --- a/工具v2/database_tools.py +++ b/工具v2/database_tools.py @@ -1329,6 +1329,21 @@ def getUnit(n): # 返回0-9的数字对应的单元名 unitlist = ["暂无对应","第一单元","第二单元","第三单元","第四单元","第五单元","第六单元","第七单元","第八单元","第九单元"] if 0<=n<=9: return unitlist[n] + +def ExtractProblemIDs(paperdict,pro_dict):#从备课组材料的每一张讲义的dict(paperdict)中提取题号 + output = [] + for key in paperdict.keys(): + if type(paperdict[key]) == list: + suslist = paperdict[key] + flag = True + for id in suslist: + if not id in pro_dict: + flag = False + break + if flag: + for id in suslist: + output.append(id) + return(output) if __name__ == "__main__": print("数据库工具, import用.") \ No newline at end of file