136 lines
3.4 KiB
Plaintext
136 lines
3.4 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 6,
|
|
"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": 7,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# 输入目标列表\n",
|
|
"t = \"\"\"K0616001B\n",
|
|
"K0616002B\n",
|
|
"K0616003B\n",
|
|
"K0616004B\n",
|
|
"K0617001B\n",
|
|
"K0617002B\n",
|
|
"K0617003B\n",
|
|
"K0617004B\n",
|
|
"K0617005B\n",
|
|
"K0617006B\n",
|
|
"K0617007B\n",
|
|
"K0619001B\n",
|
|
"K0619002B\n",
|
|
"K0619003B\n",
|
|
"K0619004B\n",
|
|
"K0619005B\n",
|
|
"K0620001B\n",
|
|
"K0620002B\n",
|
|
"K0620003B\n",
|
|
"K0620004B\n",
|
|
"K0620005B\n",
|
|
"K0623001B\n",
|
|
"K0623002B\n",
|
|
"K0623003B\n",
|
|
"K0623004B\n",
|
|
"\"\"\""
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 8,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\"K0616003B\":\"000204,004061,009211,009212,010496,010498,010505\",\n",
|
|
"\"K0616004B\":\"009710,009711\",\n",
|
|
"\"K0617002B\":\"000210,000690,004084\",\n",
|
|
"\"K0617004B\":\"010499,010500\",\n",
|
|
"\"K0617006B\":\"003475,004994,009209,009210,009988,010497\",\n",
|
|
"\"K0617007B\":\"009712,010521,010522\",\n",
|
|
"\"K0619003B\":\"000199,000202,000211,000212,000216,000364,000411,005136,009214,009218,009400,010507,010514,010519,010524\",\n",
|
|
"\"K0619004B\":\"009868,010515,010520\",\n",
|
|
"\"K0619005B\":\"009720\",\n",
|
|
"\"K0620002B\":\"000352,004669,004995,010513\",\n",
|
|
"\"K0620004B\":\"000217,000372,000402,009207,010511,010516,010518\",\n",
|
|
"\"K0620005B\":\"010517\",\n",
|
|
"\"K0623001B\":\"004196\",\n",
|
|
"\"K0623002B\":\"000215,000394,009242,009731,010814,011332\",\n",
|
|
"\"K0623004B\":\"000200,000201,000205,000213,000419,009399,009417,009732,010532\",\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
|
|
}
|