This commit is contained in:
512song@sina.com committed 2022-11-03 20:10:34 +08:00
1 parent 5eb7a1513d
commit 1dbe7f15bf
2 files changed
+67 -29

No files matched your search

+47 -9
View File
@@ -10,12 +10,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 16,
"id": "1144aaac-92a0-4bcf-aba7-096f7dd3ad3b",
"metadata": {
"execution": {
"iopub.execute_input": "2022-11-03T11:59:47.933493Z",
"iopub.status.busy": "2022-11-03T11:59:47.932972Z",
"iopub.status.idle": "2022-11-03T11:59:49.278241Z",
"shell.execute_reply": "2022-11-03T11:59:49.276741Z",
"shell.execute_reply.started": "2022-11-03T11:59:47.933444Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
@@ -34,7 +49,8 @@
" 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",
" if sheet.cell(n,5).value is not None:\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",
@@ -52,12 +68,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 17,
"id": "a57ebb22-543c-4804-8d44-89984058ec1d",
"metadata": {
"execution": {
"iopub.execute_input": "2022-11-03T12:04:25.033604Z",
"iopub.status.busy": "2022-11-03T12:04:25.033082Z",
"iopub.status.idle": "2022-11-03T12:04:25.402569Z",
"shell.execute_reply": "2022-11-03T12:04:25.401118Z",
"shell.execute_reply.started": "2022-11-03T12:04:25.033556Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import json\n",
"import time\n",
@@ -112,9 +143,16 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 18,
"id": "38397ad4-2bb3-4b5e-8ece-9ea11e801890",
"metadata": {
"execution": {
"iopub.execute_input": "2022-11-03T12:04:34.987311Z",
"iopub.status.busy": "2022-11-03T12:04:34.986720Z",
"iopub.status.idle": "2022-11-03T12:04:36.000903Z",
"shell.execute_reply": "2022-11-03T12:04:35.999784Z",
"shell.execute_reply.started": "2022-11-03T12:04:34.987262Z"
},
"tags": []
},
"outputs": [],
@@ -151,7 +189,7 @@
" list2.append('') \n",
" \n",
" list1.append(list2)\n",
"filename = 'data/天津石化体测情况表(截至20221026).xlsx'\n",
"filename = 'data/天津石化体测情况表(截至20221103).xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
@@ -374,7 +412,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
@@ -388,7 +426,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
"version": "3.8.10"
}
},
"nbformat": 4,