This commit is contained in:
512song@sina.com committed 2022-08-05 14:19:59 +08:00
1 parent 34c948fb58
commit 268fd87e95
6 files changed
+733 -118

No files matched your search

+20 -17
View File
@@ -17,16 +17,18 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import os,sys,shutil\n",
"import openpyxl\n",
"import math\n",
"\n",
"fi_xls = os.getcwd()+'/file/中国石油化工股份有限公司安庆炼化分公司员工在职人员名单.xlsx'\n",
"fi_xls = os.getcwd()+'/file/高新区.xlsx'\n",
"fi_name = {}\n",
"fi_path = os.getcwd()+'/file/210924'\n",
"fi_path = os.getcwd()+'/file/220720'\n",
"old = []\n",
"new = []\n",
"dict1 = {}\n",
@@ -35,19 +37,20 @@
"sheet = wb.active\n",
"depart = []\n",
"for n in range(2,sheet.max_row+1):\n",
" \n",
" m_name = sheet.cell(n,1).value.strip()\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[int(m_name.split('.')[0])] = [sheet.cell(n,2).value.strip(),sheet.cell(n,5).value.strip()]\n",
" if sheet.cell(n,3).value is not None: \n",
" m_name = sheet.cell(n,6).value.strip()\n",
" m_depart = sheet.cell(n,3).value.strip() \n",
" depart.append(m_depart) \n",
" dict1[int(sheet.cell(n,4).value)] = [m_name,m_depart]\n",
" #print()\n",
"# 创建部门办公室 \n",
"#m_path = fi_path = os.getcwd()+'/file/210924/new'\n",
"#for pn in depart:\n",
"# if not os.path.exists(m_path + '/' + pn):\n",
"# os.mkdir(m_path + '/' + pn)\n",
"m_path = os.getcwd()+'/file/220720/new'\n",
"for pn in depart:\n",
" if not os.path.exists(m_path + '/' + pn):\n",
" os.mkdir(m_path + '/' + pn)\n",
"#print(dict1)\n",
"\n",
"\n",
"fl=os.listdir(fi_path)\n",
"for fn in fl:\n",
" if os.path.isfile(fi_path + '/' + fn):\n",
@@ -56,17 +59,17 @@
" #print(fn)\n",
"old.sort()\n",
" #print(str(nfn)+'.pdf')\n",
"'''\n",
"\n",
"for n in old:\n",
" \n",
" o_name = f'{fi_path}/{n}.pdf'\n",
" n_name = f'{fi_path}/new/{dict1[n][1]}/{dict1[n][0]}.pdf'\n",
" n_name = f'{fi_path}/new/{dict1[n][1]}/{str(n).rjust(5,\"0\")}-{dict1[n][0]}.pdf'\n",
" if not os.path.exists(n_name):\n",
" shutil.copyfile(o_name,n_name)\n",
" print(n_name)\n",
"#print(old)\n",
"'''\n",
"print(dict1)"
"\n",
"#print(dict1)"
]
},
{