This commit is contained in:
512song@sina.com committed 2022-10-15 22:44:29 +08:00
1 parent fc3ae448ca
commit 02a878a739
2 files changed
+558

No files matched your search

+90
View File
@@ -0,0 +1,90 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "ae533fe9-e20e-4e44-b9bb-030c4fa4e714",
"metadata": {},
"source": [
"## 体测人员导入"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "1144aaac-92a0-4bcf-aba7-096f7dd3ad3b",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-15T14:33:57.992886Z",
"iopub.status.busy": "2022-10-15T14:33:57.992353Z",
"iopub.status.idle": "2022-10-15T14:33:59.266279Z",
"shell.execute_reply": "2022-10-15T14:33:59.265333Z",
"shell.execute_reply.started": "2022-10-15T14:33:57.992838Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"\n",
"wb = openpyxl.load_workbook('data/天津石化员工检测花名册 (20221014).xlsx')\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"person = {}\n",
"\n",
"for n in range(2, sheet.max_row+1):\n",
" code = sheet.cell(n, 6).value\n",
" person.setdefault(code, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 3).value\n",
" dict1['sex'] = sheet.cell(n, 4).value\n",
" dict1['unit'] = sheet.cell(n, 1).value\n",
" dict1['sub_unit'] = sheet.cell(n, 2).value\n",
" dict1['id_num'] = sheet.cell(n,5).value\n",
" person[code] = dict1\n",
"filename = 'data/天津石化人员名单.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
"print('ok')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bf980970-b95f-47f3-a93d-55a659f52471",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}