20220806
This commit is contained in:
1 parent
268fd87e95
commit
f0667bdb25
3 files changed
+4509
-24
No files matched your search
+63
-18
@@ -64,6 +64,66 @@
|
||||
"#print(dict1)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"id": "4a43668e-47ba-491f-a29c-e289885badb0",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2022-08-05T09:28:50.166885Z",
|
||||
"iopub.status.busy": "2022-08-05T09:28:50.166355Z",
|
||||
"iopub.status.idle": "2022-08-05T09:28:50.380976Z",
|
||||
"shell.execute_reply": "2022-08-05T09:28:50.379827Z",
|
||||
"shell.execute_reply.started": "2022-08-05T09:28:50.166837Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os,sys,shutil\n",
|
||||
"import openpyxl\n",
|
||||
"import math\n",
|
||||
"\n",
|
||||
"fi_xls = os.getcwd() + '/data/高新区.xlsx'\n",
|
||||
"fi_path = os.getcwd() + '/file/220720'\n",
|
||||
"old = []\n",
|
||||
"dict1 = {}\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook(fi_xls)\n",
|
||||
"sheet = wb.active\n",
|
||||
"depart = []\n",
|
||||
"for n in range(2,sheet.max_row+1): \n",
|
||||
" m_name = str(sheet.cell(n,1).value)\n",
|
||||
" m_depart = sheet.cell(n,5).value\n",
|
||||
" if m_depart not in depart:\n",
|
||||
" depart.append(sheet.cell(n,5).value)\n",
|
||||
" dict1[sheet.cell(n,4).value] = [sheet.cell(n,6).value,sheet.cell(n,3).value]\n",
|
||||
"#print(dict1)\n",
|
||||
"fl=os.listdir(fi_path)\n",
|
||||
"for fn in fl:\n",
|
||||
" if os.path.isfile(fi_path + '/' + fn):\n",
|
||||
" ofn = int(fn.split('.')[0])\n",
|
||||
" old.append(ofn) \n",
|
||||
"old.sort()\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"i = 0\n",
|
||||
" \n",
|
||||
"for item in old:\n",
|
||||
" m_bh = item\n",
|
||||
" m_name = dict1[item][0]\n",
|
||||
" m_dep = dict1[item][1]\n",
|
||||
" i += 1\n",
|
||||
" sheet[f'A{i}'] = m_bh\n",
|
||||
" sheet[f'B{i}'] = m_name\n",
|
||||
" sheet[f'C{i}'] = m_dep\n",
|
||||
" \n",
|
||||
" \n",
|
||||
"wb.save('data/高新区报告.xlsx') "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "72866db8-89be-4498-b854-a3aefe4c897a",
|
||||
@@ -126,16 +186,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 38,
|
||||
"execution_count": null,
|
||||
"id": "a34c9f6b-4ef3-4678-89bb-8b692e183968",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2022-07-31T13:49:49.854261Z",
|
||||
"iopub.status.busy": "2022-07-31T13:49:49.853622Z",
|
||||
"iopub.status.idle": "2022-07-31T13:49:50.369847Z",
|
||||
"shell.execute_reply": "2022-07-31T13:49:50.368685Z",
|
||||
"shell.execute_reply.started": "2022-07-31T13:49:49.854177Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
@@ -233,17 +286,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 37,
|
||||
"execution_count": null,
|
||||
"id": "d77c3ff5-91fb-4449-80fb-57bc467c27bd",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2022-07-27T14:01:56.902136Z",
|
||||
"iopub.status.busy": "2022-07-27T14:01:56.901602Z",
|
||||
"iopub.status.idle": "2022-07-27T14:01:56.957533Z",
|
||||
"shell.execute_reply": "2022-07-27T14:01:56.956472Z",
|
||||
"shell.execute_reply.started": "2022-07-27T14:01:56.902088Z"
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
|
||||
Reference in new issue
Block a user