keywords_dict = { "id":[""], #题号 "content":["导数"], #题面内容 "objs":[""], #目标代码 "tags":[""], #标签, 如["第二单元"]等 "genre":[""], #题目类型, 填空题, 选择题, 解答题 "ans":[""], #答案 "solution":[""], #解答与提示 "duration":[""], #解题时间(目前未设置) "usages":[""], #使用记录, 数据库中格式为 <日期>\t<届别><班别>\t正确率[\t正确率]... 例如"20230301\t2023届01班\t0.985\t0.211 "origin":[""], #题目来源 "edit":[""], #导入者及编辑者 "same":[""], #相同题目题号 "related":[""], #关联题目题号 "remark":[""], #备注, 注记 "space":[""], #解答题下的空间(em)表示一个m的宽度 "unrelated":[""], #无关题目题号 # "content2":["双曲线"], #在字段名中加入数字表示这个字段的另一个必要条件 "content_not":["OBSOLETE"], #加_not表示不能出现该样式的词 } #同一字段名中的条件为"或"的关系, 不同字段名(可加数字表示同一字段)中的条件为"且"的关系 outputfilepath = "临时文件/题号筛选.txt" from database_tools import * prodictpath = "../题库0.3/problems.json" pro_dict = load_dict(prodictpath) matchlist = [id for id in pro_dict if MatchCondition(pro_dict[id],keywords_dict)] matchstring = generate_exp(matchlist) SaveTextFile(matchstring,outputfilepath) os.system("code -g %s:1"%outputfilepath)