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,
+20 -20
View File
@@ -10,15 +10,15 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 6,
"id": "a27e986c-0c40-4792-b24d-03b19df707a9",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-31T13:50:14.056581Z",
"iopub.status.busy": "2022-10-31T13:50:14.055983Z",
"iopub.status.idle": "2022-10-31T13:50:15.632245Z",
"shell.execute_reply": "2022-10-31T13:50:15.630795Z",
"shell.execute_reply.started": "2022-10-31T13:50:14.056464Z"
"iopub.execute_input": "2022-11-03T12:05:14.162807Z",
"iopub.status.busy": "2022-11-03T12:05:14.162264Z",
"iopub.status.idle": "2022-11-03T12:05:15.514597Z",
"shell.execute_reply": "2022-11-03T12:05:15.513708Z",
"shell.execute_reply.started": "2022-11-03T12:05:14.162759Z"
},
"tags": []
},
@@ -72,15 +72,15 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"id": "e5e4145b-d575-46b5-a530-c722668f76f3",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-31T13:54:54.428022Z",
"iopub.status.busy": "2022-10-31T13:54:54.427379Z",
"iopub.status.idle": "2022-10-31T13:54:54.840785Z",
"shell.execute_reply": "2022-10-31T13:54:54.839677Z",
"shell.execute_reply.started": "2022-10-31T13:54:54.427973Z"
"iopub.execute_input": "2022-11-03T12:04:52.389836Z",
"iopub.status.busy": "2022-11-03T12:04:52.389246Z",
"iopub.status.idle": "2022-11-03T12:04:52.901781Z",
"shell.execute_reply": "2022-11-03T12:04:52.900587Z",
"shell.execute_reply.started": "2022-11-03T12:04:52.389788Z"
},
"tags": []
},
@@ -147,15 +147,15 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 7,
"id": "0582bc84-7234-415f-9715-66c27b6b8f91",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-31T13:55:58.223912Z",
"iopub.status.busy": "2022-10-31T13:55:58.223359Z",
"iopub.status.idle": "2022-10-31T13:55:59.450036Z",
"shell.execute_reply": "2022-10-31T13:55:59.448892Z",
"shell.execute_reply.started": "2022-10-31T13:55:58.223865Z"
"iopub.execute_input": "2022-11-03T12:05:19.504467Z",
"iopub.status.busy": "2022-11-03T12:05:19.503886Z",
"iopub.status.idle": "2022-11-03T12:05:21.059764Z",
"shell.execute_reply": "2022-11-03T12:05:21.058715Z",
"shell.execute_reply.started": "2022-11-03T12:05:19.504418Z"
},
"tags": []
},
@@ -177,7 +177,7 @@
"list1 = []\n",
"for k, v in dict1.items():\n",
" list2 = []\n",
" list2.append(str(k).rjust(8,'0'))\n",
" list2.append(str(k).rjust(5,'0'))\n",
" list2.append(v['name']) \n",
" list2.append(dict2[k]['sex'])\n",
" list2.append(dict2[k]['unit']) \n",
@@ -190,7 +190,7 @@
" else:\n",
" list2.append('') \n",
" list1.append(list2)\n",
"filename = 'data/巴陵石化体测情况表(截至20221031).xlsx'\n",
"filename = 'data/巴陵石化体测情况表(截至20221103).xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",