This commit is contained in:
512song@sina.com committed 2022-10-02 15:10:40 +08:00
1 parent d7b37d117d
commit ed2a70896c
3 files changed
+382 -72

No files matched your search

+105 -19
View File
@@ -49,6 +49,108 @@
"print('ok')"
]
},
{
"cell_type": "markdown",
"id": "eefb520d-0aee-4f92-b6a9-af9efaa88049",
"metadata": {},
"source": [
"### 导出测试成绩"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c1e1b40c-d73a-4e2e-8c22-4d3ae73ede6f",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"items = ['身高','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"title = ['编号','姓名','年龄','身高','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"filename = 'data/result_2209.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"list1 = []\n",
"for k, v in dict1.items():\n",
" list2 = []\n",
" list2.append(k)\n",
" list2.append(v['name'])\n",
" if 'id' in v.keys(): \n",
" age = v['id'][6:10]+'-'+v['id'][10:12]+'-'+v['id'][12:14]\n",
" else:\n",
" age = v['birth']\n",
" list2.append(age)\n",
" for item in items:\n",
" if item in v.keys():\n",
" list2.append(v[item]['成绩'])\n",
" elif item =='name':\n",
" list2.append(v[item])\n",
" else:\n",
" list2.append('') \n",
" list1.append(list2)\n",
"filename = 'data/2022年安庆得分情况表.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)"
]
},
{
"cell_type": "code",
"execution_count": 236,
"id": "a3f0d4b9-78c6-4fd2-baf7-a05962e7904c",
"metadata": {
"execution": {
"iopub.execute_input": "2022-09-30T13:02:25.562088Z",
"iopub.status.busy": "2022-09-30T13:02:25.561502Z",
"iopub.status.idle": "2022-09-30T13:02:26.553518Z",
"shell.execute_reply": "2022-09-30T13:02:26.552452Z",
"shell.execute_reply.started": "2022-09-30T13:02:25.562039Z"
}
},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"items = ['身高','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"title = ['编号','姓名','身高','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"filename = 'data/result_2209.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"list1 = []\n",
"for k, v in dict1.items():\n",
" list2 = []\n",
" list2.append(k)\n",
" list2.append(v['name'])\n",
" \n",
" for item in items:\n",
" if item in v.keys():\n",
" list2.append(v[item]['成绩'])\n",
" elif item =='name':\n",
" list2.append(v[item])\n",
" else:\n",
" list2.append('') \n",
" list1.append(list2)\n",
"filename = 'data/2022年安庆得分情况表.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)"
]
},
{
"cell_type": "markdown",
"id": "e5aa1bf4-c68c-4843-a9fb-c3fe48ff1f39",
@@ -114,30 +216,14 @@
},
{
"cell_type": "code",
"execution_count": 226,
"execution_count": null,
"id": "a00ec014-a4e5-4f8f-9cd5-7b3bd736ad85",
"metadata": {
"execution": {
"iopub.execute_input": "2022-09-27T14:02:23.012372Z",
"iopub.status.busy": "2022-09-27T14:02:23.011852Z",
"iopub.status.idle": "2022-09-27T14:02:23.095005Z",
"shell.execute_reply": "2022-09-27T14:02:23.093941Z",
"shell.execute_reply.started": "2022-09-27T14:02:23.012324Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1892 马向东 该人员已经测试!\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"import operator\n",
"\n",
"filename = '../item.json'\n",
"item = {}\n",
@@ -222,7 +308,7 @@
" dict1['sex'] = sex\n",
" dict1['unit'] = sheet.cell(n, 1).value\n",
" dict1['id_num'] = sheet.cell(n,6).value\n",
" person[code] = dict1\n",
" person[code] = dict1\n",
"filename = 'data/安庆炼化人员名单2022.json'\n",
"with open(filename, 'r') as fl:\n",
" dict2 = json.load(fl)\n",