filepath = r"Z:\home\solutions23\概率续校本参考解答\概率续校本作业参考解答.pdf" # 设置文件路径 from database_tools import * if filepath.endswith(".pdf"): data = parsePDF(filepath) else: data = ReadTextFile(filepath) ids = re.findall(r"\((\d{6})\)",data) print(generate_exp(ids)) # 输出文件中的题号字符串