173 lines
4.6 KiB
Plaintext
173 lines
4.6 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"020404 填空题\n",
|
|
"020405 填空题\n",
|
|
"020406 选择题\n",
|
|
"020407 选择题\n",
|
|
"020408 选择题\n",
|
|
"020409 解答题\n",
|
|
"020410 解答题\n",
|
|
"020411 解答题\n",
|
|
"020412 解答题\n",
|
|
"020413 填空题\n",
|
|
"020414 填空题\n",
|
|
"020415 填空题\n",
|
|
"020416 填空题\n",
|
|
"020417 选择题\n",
|
|
"020418 选择题\n",
|
|
"020419 选择题\n",
|
|
"020420 填空题\n",
|
|
"020421 解答题\n",
|
|
"020422 解答题\n",
|
|
"020423 填空题\n",
|
|
"020424 填空题\n",
|
|
"020425 解答题\n",
|
|
"020426 解答题\n",
|
|
"020427 填空题\n",
|
|
"020428 填空题\n",
|
|
"020429 填空题\n",
|
|
"020430 填空题\n",
|
|
"020431 填空题\n",
|
|
"020432 解答题\n",
|
|
"020433 解答题\n",
|
|
"020434 解答题\n",
|
|
"020435 填空题\n",
|
|
"020436 填空题\n",
|
|
"020437 填空题\n",
|
|
"020438 填空题\n",
|
|
"020439 选择题\n",
|
|
"020440 选择题\n",
|
|
"020441 选择题\n",
|
|
"020442 选择题\n",
|
|
"020443 解答题\n",
|
|
"020444 解答题\n",
|
|
"020445 解答题\n",
|
|
"020446 填空题\n",
|
|
"020447 填空题\n",
|
|
"020448 解答题\n",
|
|
"020449 解答题\n",
|
|
"020450 填空题\n",
|
|
"020451 选择题\n",
|
|
"020452 填空题\n",
|
|
"020453 解答题\n",
|
|
"020454 解答题\n",
|
|
"020455 解答题\n",
|
|
"020456 填空题\n",
|
|
"020457 解答题\n",
|
|
"020458 解答题\n",
|
|
"020459 填空题\n",
|
|
"020460 填空题\n",
|
|
"020461 填空题\n",
|
|
"020462 填空题\n",
|
|
"020463 解答题\n",
|
|
"020464 填空题\n",
|
|
"020465 选择题\n",
|
|
"020466 解答题\n",
|
|
"020467 填空题\n",
|
|
"020468 填空题\n",
|
|
"020469 填空题\n",
|
|
"020470 解答题\n",
|
|
"020471 解答题\n",
|
|
"020472 解答题\n",
|
|
"020473 解答题\n",
|
|
"020474 解答题\n",
|
|
"020475 解答题\n",
|
|
"020476 选择题\n",
|
|
"020477 选择题\n",
|
|
"020478 选择题\n",
|
|
"020479 填空题\n",
|
|
"020480 解答题\n",
|
|
"020481 解答题\n",
|
|
"020482 填空题\n",
|
|
"020483 填空题\n",
|
|
"020484 填空题\n",
|
|
"020485 填空题\n",
|
|
"020486 填空题\n",
|
|
"020487 选择题\n",
|
|
"020488 解答题\n",
|
|
"020489 解答题\n",
|
|
"020490 解答题\n",
|
|
"020491 解答题\n",
|
|
"020492 填空题\n",
|
|
"020493 填空题\n",
|
|
"020494 填空题\n",
|
|
"020495 解答题\n",
|
|
"020496 解答题\n",
|
|
"020497 解答题\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"import os,re,json\n",
|
|
"\n",
|
|
"# 读取数据库并转成题目字典\n",
|
|
"with open(r\"../题库0.3/Problems.json\",\"r\",encoding = \"utf8\") as f:\n",
|
|
" database = f.read()\n",
|
|
"pro_dict = json.loads(database)\n",
|
|
"\n",
|
|
"#根据特征字符识别题目类型\n",
|
|
"for p in pro_dict:\n",
|
|
" if pro_dict[p][\"genre\"] == \"\":\n",
|
|
" if \"bracket\" in pro_dict[p][\"content\"]:\n",
|
|
" pro_dict[p][\"genre\"] = \"选择题\"\n",
|
|
" print(p,\"选择题\")\n",
|
|
" elif \"blank\" in pro_dict[p][\"content\"]:\n",
|
|
" pro_dict[p][\"genre\"] = \"填空题\"\n",
|
|
" print(p,\"填空题\")\n",
|
|
" else:\n",
|
|
" pro_dict[p][\"genre\"] = \"解答题\"\n",
|
|
" pro_dict[p][\"space\"] = \"12ex\"\n",
|
|
" print(p,\"解答题\")\n",
|
|
"\n",
|
|
"#将修改结果写入json数据库\n",
|
|
"database = json.dumps(pro_dict,indent = 4, ensure_ascii= False)\n",
|
|
"with open(r\"../题库0.3/Problems.json\",\"w\",encoding = \"utf8\") as f:\n",
|
|
" f.write(database)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "mathdept",
|
|
"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.15"
|
|
},
|
|
"orig_nbformat": 4,
|
|
"vscode": {
|
|
"interpreter": {
|
|
"hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc"
|
|
}
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|