{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "周末卷02.tex\n", "010944\n", "\n", "\n", "030017\n", "\n", "\n", "010946\n", "\n", "\n", "010947\n", "\n", "\n", "010948\n", "\n", "\n", "010949\n", "\n", "\n", "010950\n", "\n", "\n", "010951\n", "\n", "\n", "010952\n", "\n", "\n", "010953\n", "\n", "\n", "010954\n", "\n", "\n", "010955\n", "\n", "\n", "010956\n", "\n", "\n", "010958\n", "\n", "\n", "010959\n", "\n", "\n", "010960\n", "\n", "\n", "010961\n", "\n", "\n", "010962\n", "\n", "\n", "010963\n", "\n", "\n", "010964\n", "\n", "\n" ] } ], "source": [ "import os,json,re\n", "\n", "#这里需要修改, 设定路径与选择文件\n", "fileind = 1\n", "# path = r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\第一轮复习讲义\"\n", "path = r\"C:\\Users\\weiye\\Documents\\wwy sync\\23届\\上学期周末卷\"\n", "\n", "with open(\"../题库0.3/Problems.json\",\"r\",encoding = \"utf8\") as f:\n", " jsondata = f.read()\n", "pro_dict = json.loads(jsondata)\n", "\n", "filelist = [f for f in os.listdir(path) if \".tex\" in f]\n", "file = filelist[fileind]\n", "print(file)\n", "with open(os.path.join(path,file),\"r\",encoding = \"utf8\") as f:\n", " data = f.read()\n", " idlist = re.findall(r\"\\(([\\d]{6})\\)\",data)\n", " for id in idlist:\n", " if pro_dict[id][\"ans\"].strip() == \"\":\n", " print(id+\"\\n\\n\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3.9.7 ('base')", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.7" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "e4cce46d6be9934fbd27f9ca0432556941ea5bdf741d4f4d64c6cd7f8dfa8fba" } } }, "nbformat": 4, "nbformat_minor": 2 }