20250916
This commit is contained in:
1 parent
5bd40c3755
commit
689c26b967
7 files changed
+396
-116
No files matched your search
@@ -340,6 +340,55 @@
|
||||
"wb.save(filename)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "75b98b19-ab32-414a-b3f2-6efd58e1f9a9",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-08-28T09:16:02.802494Z",
|
||||
"iopub.status.busy": "2025-08-28T09:16:02.801898Z",
|
||||
"iopub.status.idle": "2025-08-28T09:16:02.994884Z",
|
||||
"shell.execute_reply": "2025-08-28T09:16:02.994340Z",
|
||||
"shell.execute_reply.started": "2025-08-28T09:16:02.802438Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n",
|
||||
"title = ['编号','姓名','性别','单位','部门','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"\n",
|
||||
"filename = 'data/result_宁夏能化人员all.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"filename = 'data/宁夏能化人员all.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl)\n",
|
||||
" \n",
|
||||
"list1 = []\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" list2 = []\n",
|
||||
" list2.append(str(k).rjust(5,'0'))\n",
|
||||
" list2.append(v['name']) \n",
|
||||
" list2.append(v['sex'])\n",
|
||||
" list2.append(v['unit'])\n",
|
||||
" list2.append(v['age'])\n",
|
||||
" \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)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "699c6a40-a6ae-4300-9646-708cb85aa5e8",
|
||||
|
||||
Reference in new issue
Block a user