111 lines
2.6 KiB
Plaintext
111 lines
2.6 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"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 = \"\"\"K0629001X\n",
|
|
"K0629002X\n",
|
|
"K0629003X\n",
|
|
"K0630001X\n",
|
|
"K0630002X\n",
|
|
"K0630003X\n",
|
|
"K0630004X\n",
|
|
"K0631001X\n",
|
|
"K0631002X\n",
|
|
"K0631003X\n",
|
|
"\"\"\""
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\"K0629001X\":\"000293,000297,009868,010740,030465\",\n",
|
|
"\"K0630002X\":\"000298,000302,000304,001948,004348,009870,010721,010730\",\n",
|
|
"\"K0630004X\":\"000294,000300,003647,004656,004698,004740,009871,010732,010735,030462,030472\",\n",
|
|
"\"K0631002X\":\"000303,000305,001981,004243,009873,010739\",\n",
|
|
"\"K0631003X\":\"000295,000296,000299,004096,009872,010737,030461,030468\",\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.8.8 ('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.8.8"
|
|
},
|
|
"orig_nbformat": 4,
|
|
"vscode": {
|
|
"interpreter": {
|
|
"hash": "d311ffef239beb3b8f3764271728f3972d7b090c974f8e972fcdeedf230299ac"
|
|
}
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|