120 lines
3.3 KiB
Plaintext
120 lines
3.3 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": 5,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# 输入目标列表\n",
|
|
"t = \"\"\"K0232001X \n",
|
|
"K0232002X \n",
|
|
"K0232003X \n",
|
|
"K0232004X \n",
|
|
"K0233001X \n",
|
|
"K0233002X \n",
|
|
"K0233003X \n",
|
|
"K0234001X \n",
|
|
"K0234002X \n",
|
|
"K0234003X \n",
|
|
"K0234004X \n",
|
|
"K0234005X \n",
|
|
"K0235001X\"\"\""
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 6,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\"K0232001X\":\"030344,030374,030407\",\n",
|
|
"\"K0232002X\":\"004013,009918,009919,010819,010820,010823,010824,030343,030345,030347,030348,030349,030356,030360,030361,030375,030385,030387,030408,030409,030410,030416,030422\",\n",
|
|
"\"K0232003X\":\"030415\",\n",
|
|
"\"K0232004X\":\"030372,030379\",\n",
|
|
"\"K0233001X\":\"004007\",\n",
|
|
"\"K0233002X\":\"010825,010827,030377\",\n",
|
|
"\"K0233003X\":\"004005,004009,009920,009921,010803,010822,010828,030350,030351,030362,030411,030412,030417,030425\",\n",
|
|
"\"K0234001X\":\"009922,010821\",\n",
|
|
"\"K0234003X\":\"004006,004014,005114,005115,005116,005121,005135,009923,009924,010826,030051,030352,030354,030363,030378,030413,030418,030419,030420,030424,030426\",\n",
|
|
"\"K0234004X\":\"030346,030376\",\n",
|
|
"\"K0234005X\":\"030353,030355,030358,030369,030386,030414,030421,030423\",\n",
|
|
"\"K0235001X\":\"004010,004011,004012,009925,009926,010829,010830,030357,030359,030364,030365,030366,030367,030368,030380,030382,030383,030384\",\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"dict1 = {}\n",
|
|
"for o in [l.strip() 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
|
|
}
|