113 lines
2.6 KiB
Plaintext
113 lines
2.6 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"with open(\"../题库0.3/Problems.json\",\"r\",encoding = \"utf8\") as f:\n",
|
|
" database = f.read()\n",
|
|
"import json\n",
|
|
"pro_dict = json.loads(database)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# 输入目标列表\n",
|
|
"t = \"\"\"K0807001B\n",
|
|
"K0807002B\n",
|
|
"K0807003B\n",
|
|
"K0808001B\n",
|
|
"K0808002B\n",
|
|
"K0808003B\n",
|
|
"K0808004B\n",
|
|
"K0809001B\n",
|
|
"K0809002B\n",
|
|
"K0809003B\n",
|
|
"\"\"\""
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\"K0807002B\":\"009356\",\n",
|
|
"\"K0807003B\":\"000224,000230,003734,009357,009747,009748,009749,010552,010553,010554\",\n",
|
|
"\"K0808002B\":\"000226,000611,000624,000685,000695,000704,000812,004087,004150,004324,004750,009750,010555,010559,010560\",\n",
|
|
"\"K0808003B\":\"009751,010557,010558\",\n",
|
|
"\"K0809001B\":\"009752\",\n",
|
|
"\"K0809002B\":\"009753\",\n",
|
|
"\"K0809003B\":\"009754\",\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"dict1 = {}\n",
|
|
"for o in [l for l in t.split(\"\\n\") if len(l.strip())>0]:\n",
|
|
" dict1[o] = []\n",
|
|
"for id in pro_dict:\n",
|
|
" for o in dict1:\n",
|
|
" objs = pro_dict[id][\"objs\"]\n",
|
|
" flag = True\n",
|
|
" if not o in objs:\n",
|
|
" flag = False\n",
|
|
" for obj in objs:\n",
|
|
" if obj > o:\n",
|
|
" flag = False\n",
|
|
" break\n",
|
|
" if flag:\n",
|
|
" dict1[o].append(id)\n",
|
|
"for o in dict1:\n",
|
|
" if not dict1[o] == []:\n",
|
|
" print('\"'+o+'\":\"'+\",\".join(dict1[o])+'\",')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 21,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"\n"
|
|
]
|
|
}
|
|
],
|
|
"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
|
|
}
|