This repository has been archived on 2024-06-23. You can view files and clone it, but cannot push or open issues or pull requests.
mathdeptv2/工具/寻找未赋答案题目.py

33 lines
1.5 KiB
Python

import os,json,re
#这里需要修改, 设定路径与选择文件
directories = [r"C:\Users\weiye\Documents\wwy sync\23届\上学期测验卷",
r"C:\Users\weiye\Documents\wwy sync\23届\上学期周末卷",
r"C:\Users\weiye\Documents\wwy sync\23届\第一轮复习讲义",
r"C:\Users\weiye\Documents\wwy sync\23届\赋能",
r"C:\Users\weiye\Documents\wwy sync\23届\一模后春考前试卷备选",
r"C:\Users\weiye\Documents\wwy sync\23届\第二轮复习讲义",
r"C:\Users\weiye\Documents\wwy sync\23届\下学期测验卷",
r"C:\Users\weiye\Documents\wwy sync\23届\下学期周末卷",
r"C:\Users\weiye\Documents\wwy sync\23届\寒假作业",
r"C:\Users\weiye\Documents\wwy sync\23届\正态分布及成对数据新课",
r"C:\Users\weiye\Documents\wwy sync\23届\第三轮复习讲义",
r"C:\Users\weiye\Documents\wwy sync\23届\双基冲刺卷",
r"C:\Users\weiye\Documents\wwy sync\23届\简单题冲刺",
r"C:\Users\weiye\Documents\wwy sync\23届\中档题冲刺"
]
with open("../题库0.3/Problems.json","r",encoding = "utf8") as f:
jsondata = f.read()
pro_dict = json.loads(jsondata)
for directory in directories:
filelist = [f for f in os.listdir(directory) if ".tex" in f]
for file in filelist:
print(file)
with open(os.path.join(directory,file),"r",encoding = "utf8") as f:
data = f.read()
idlist = re.findall(r"\(([\d]{6})\)",data)
for id in idlist:
if pro_dict[id]["ans"].strip() == "":
print(id+"\n\n")