20250916
This commit is contained in:
1 parent
5bd40c3755
commit
689c26b967
7 files changed
+396
-116
No files matched your search
+62
-2
@@ -104,6 +104,66 @@
|
||||
" "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "e22401f7-9c02-4c4b-a935-e844e56d099b",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 汇总目录下所有文件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "11ff2c59-5815-42c9-abaf-71c8c2a3b7da",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os,sys,shutil\n",
|
||||
"from pathlib import Path\n",
|
||||
"\n",
|
||||
"fi_path = 'file/北海/未参加体测人员报告'\n",
|
||||
"new_path = 'file/北海/new/未参加体测人员'\n",
|
||||
"pdf_files = list(fi_path.glob('**/*.pdf'))\n",
|
||||
"\n",
|
||||
"for fn in fls:\n",
|
||||
" fi_name =Path(fn).stem.split('-')[0]\n",
|
||||
" code = int(fi_name) \n",
|
||||
" unit_path = Path(new_path,dict1[str(code)]['unit'])\n",
|
||||
" unit_path.mkdir(parents = True, exist_ok = True)\n",
|
||||
" n_name = Path(unit_path,Path(fn).stem+'.pdf')\n",
|
||||
" #if not os.path.exists(n_name):\n",
|
||||
" shutil.copyfile(fn,n_name)\n",
|
||||
" print(fn)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"id": "62ff063a-5380-4e08-b115-acd967441ca4",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-09-16T02:36:40.592582Z",
|
||||
"iopub.status.busy": "2025-09-16T02:36:40.591749Z",
|
||||
"iopub.status.idle": "2025-09-16T02:36:40.635821Z",
|
||||
"shell.execute_reply": "2025-09-16T02:36:40.635329Z",
|
||||
"shell.execute_reply.started": "2025-09-16T02:36:40.592518Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os,sys,shutil\n",
|
||||
"from pathlib import Path\n",
|
||||
"\n",
|
||||
"fi_path =Path('file/北海/未参加体测人员报告')\n",
|
||||
"new_path = 'file/北海/new/未参加体测人员'\n",
|
||||
"fls = list(fi_path.glob('**/*.pdf'))\n",
|
||||
"for fn in fls:\n",
|
||||
" fi_name =Path(fn).name\n",
|
||||
" n_name = Path(new_path,fi_name)\n",
|
||||
" shutil.copyfile(fn,n_name)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@@ -1370,7 +1430,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
@@ -1384,7 +1444,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.10"
|
||||
"version": "3.12.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in new issue
Block a user