This commit is contained in:
512song@sina.com committed 2022-11-08 21:22:16 +08:00
1 parent 590c1f95d7
commit 6e4ecae461
1 file changed
+45 -8
+45 -8
View File
@@ -10,12 +10,27 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 6,
"id": "a27e986c-0c40-4792-b24d-03b19df707a9", "id": "a27e986c-0c40-4792-b24d-03b19df707a9",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2022-11-08T12:44:07.296735Z",
"iopub.status.busy": "2022-11-08T12:44:07.296180Z",
"iopub.status.idle": "2022-11-08T12:44:08.671501Z",
"shell.execute_reply": "2022-11-08T12:44:08.670323Z",
"shell.execute_reply.started": "2022-11-08T12:44:07.296686Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [ "source": [
"import openpyxl\n", "import openpyxl\n",
"import json\n", "import json\n",
@@ -57,12 +72,27 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 7,
"id": "e5e4145b-d575-46b5-a530-c722668f76f3", "id": "e5e4145b-d575-46b5-a530-c722668f76f3",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2022-11-08T12:45:30.125598Z",
"iopub.status.busy": "2022-11-08T12:45:30.125074Z",
"iopub.status.idle": "2022-11-08T12:45:30.758312Z",
"shell.execute_reply": "2022-11-08T12:45:30.757020Z",
"shell.execute_reply.started": "2022-11-08T12:45:30.125550Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [ "source": [
"import json\n", "import json\n",
"import time\n", "import time\n",
@@ -117,9 +147,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 8,
"id": "0582bc84-7234-415f-9715-66c27b6b8f91", "id": "0582bc84-7234-415f-9715-66c27b6b8f91",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2022-11-08T12:46:03.182505Z",
"iopub.status.busy": "2022-11-08T12:46:03.181985Z",
"iopub.status.idle": "2022-11-08T12:46:05.094052Z",
"shell.execute_reply": "2022-11-08T12:46:05.092913Z",
"shell.execute_reply.started": "2022-11-08T12:46:03.182458Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [],
@@ -140,7 +177,7 @@
"list1 = []\n", "list1 = []\n",
"for k, v in dict1.items():\n", "for k, v in dict1.items():\n",
" list2 = []\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(v['name']) \n",
" list2.append(dict2[k]['sex'])\n", " list2.append(dict2[k]['sex'])\n",
" list2.append(dict2[k]['unit']) \n", " list2.append(dict2[k]['unit']) \n",
@@ -153,7 +190,7 @@
" else:\n", " else:\n",
" list2.append('') \n", " list2.append('') \n",
" list1.append(list2)\n", " list1.append(list2)\n",
"filename = 'data/巴陵石化体测情况表(截至20221031).xlsx'\n", "filename = 'data/巴陵石化体测情况表(截至20221108).xlsx'\n",
"wb = openpyxl.Workbook()\n", "wb = openpyxl.Workbook()\n",
"sheet = wb.active\n", "sheet = wb.active\n",
"sheet.append(title)\n", "sheet.append(title)\n",
@@ -382,7 +419,7 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 3 (ipykernel)", "display_name": "Python 3",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },