关键字筛选题号中关于出处的匹配适应了新的origin格式
This commit is contained in:
parent
433533c5e9
commit
b97b62d6a3
|
|
@ -917,12 +917,17 @@ def StripSuffix(string, suf_words): #除去字符串前后的空格及suf_words
|
||||||
return(string) # 返回处理以后的字符串
|
return(string) # 返回处理以后的字符串
|
||||||
|
|
||||||
|
|
||||||
def MatchCondition2014(problem,condition_list): #判断problem这一字典是否符合condition_list中的所有筛选条件
|
def MatchCondition2024(problem,condition_list): #判断problem这一字典是否符合condition_list中的所有筛选条件
|
||||||
match = True #初始设定符合条件
|
match = True #初始设定符合条件
|
||||||
for field, flag_not, matchexp in condition_list:
|
for field, flag_not, matchexp in condition_list:
|
||||||
exps = [i.strip() for i in matchexp.split(",")]
|
exps = [i.strip() for i in matchexp.split(",")]
|
||||||
if problem[field] == list:
|
if type(problem[field]) == list:
|
||||||
data = "\n".join(problem[field])
|
data = "\n".join(problem[field])
|
||||||
|
elif field == "origin":
|
||||||
|
if "题号" in problem[field]:
|
||||||
|
data = problem[field]["来源"]+"试题"+str(problem[field]["题号"]).zfill(2)
|
||||||
|
else:
|
||||||
|
data = problem[field]["来源"]
|
||||||
else:
|
else:
|
||||||
data = str(problem[field]) #至此将每个字段中的内容都转为string
|
data = str(problem[field]) #至此将每个字段中的内容都转为string
|
||||||
if flag_not == False: #表示肯定的筛选
|
if flag_not == False: #表示肯定的筛选
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class MyWindow(QWidget,Ui_Form):
|
||||||
self.matchlist = []
|
self.matchlist = []
|
||||||
self.conditions.append(("content",True,"OBSOLETE"))
|
self.conditions.append(("content",True,"OBSOLETE"))
|
||||||
for id in self.pro_dict:
|
for id in self.pro_dict:
|
||||||
if MatchCondition2014(self.pro_dict[id],self.conditions):
|
if MatchCondition2024(self.pro_dict[id],self.conditions):
|
||||||
self.matchlist.append(id)
|
self.matchlist.append(id)
|
||||||
self.conditions = self.conditions[:-1].copy()
|
self.conditions = self.conditions[:-1].copy()
|
||||||
self.lcdNumber_resCount.display(len(self.matchlist))
|
self.lcdNumber_resCount.display(len(self.matchlist))
|
||||||
|
|
|
||||||
Reference in New Issue