This commit is contained in:
512song committed 2023-07-12 16:54:09 +08:00
1 parent 08121d7167
commit 8e449c63b3
4 files changed
+1113 -21

No files matched your search

+77 -1
View File
@@ -237,9 +237,16 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 236,
"id": "79c9c728-12e9-4107-bc5a-8c3e3d8b64a6",
"metadata": {
"execution": {
"iopub.execute_input": "2023-07-10T02:50:01.428216Z",
"iopub.status.busy": "2023-07-10T02:50:01.427358Z",
"iopub.status.idle": "2023-07-10T02:50:04.539871Z",
"shell.execute_reply": "2023-07-10T02:50:04.539123Z",
"shell.execute_reply.started": "2023-07-10T02:50:01.428175Z"
},
"tags": []
},
"outputs": [],
@@ -285,6 +292,75 @@
"wb.save(filename)"
]
},
{
"cell_type": "markdown",
"id": "db76f131-4094-46ca-9b27-7c6648875dc2",
"metadata": {},
"source": [
"## 总成绩导出(带得分)"
]
},
{
"cell_type": "code",
"execution_count": 238,
"id": "ca44ae23-f756-4622-9cb0-553b1e119cc3",
"metadata": {
"execution": {
"iopub.execute_input": "2023-07-10T02:58:50.440553Z",
"iopub.status.busy": "2023-07-10T02:58:50.439776Z",
"iopub.status.idle": "2023-07-10T02:58:53.380936Z",
"shell.execute_reply": "2023-07-10T02:58:53.379903Z",
"shell.execute_reply.started": "2023-07-10T02:58:50.440520Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"title = ['编号','姓名','性别','单位/部门','身高','','体重','','肺活量','','握力','','坐位体前屈','','纵跳','','俯卧撑','','一分钟仰卧起坐','','单脚站立','','选择反应时','','台阶指数']\n",
"\n",
"filename = 'data/result_燕山石化.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"for k, v in dict1.items(): #print(k,dict2[str(k)]['name'])\n",
" list2 = []\n",
" list2.append(str(k).rjust(5,'0'))\n",
" list2.append(dict1[k]['name']) \n",
" list2.append(dict1[k]['sex'])\n",
" list2.append(dict1[k]['unit']) \n",
" for item in items:\n",
" if item in dict1[k].keys():\n",
" list2.append(dict1[k][item]['成绩'])\n",
" list2.append(dict1[k][item]['得分']) \n",
" elif item =='name':\n",
" list2.append(dict1[k][item])\n",
" else:\n",
" list2.append('') \n",
" list2.append('') \n",
" list1.append(list2)\n",
"filename = 'data/燕山石化体测情况表.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
"for row in list1:\n",
" sheet.append(row)\n",
" \n",
"wb.save(filename)\n",
"print('ok') "
]
},
{
"cell_type": "markdown",
"id": "6d431fc1-b743-467c-91b3-9788e245becb",