20020506
This commit is contained in:
1 parent
4611fae329
commit
cbc1f8e56b
1 file changed
+36
+36
@@ -64,6 +64,42 @@
|
|||||||
"#print(dict1)"
|
"#print(dict1)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "bbf0b425-c0ce-4608-ae52-85a78ddcd6c0",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 批量更换扩展名"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 6,
|
||||||
|
"id": "2c2bd1d1-4d84-4639-ba20-c97c218ae275",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2022-05-06T14:01:25.901198Z",
|
||||||
|
"iopub.status.busy": "2022-05-06T14:01:25.900687Z",
|
||||||
|
"iopub.status.idle": "2022-05-06T14:01:25.911729Z",
|
||||||
|
"shell.execute_reply": "2022-05-06T14:01:25.910606Z",
|
||||||
|
"shell.execute_reply.started": "2022-05-06T14:01:25.901153Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import glob\n",
|
||||||
|
"import os,shutil\n",
|
||||||
|
"\n",
|
||||||
|
"filepath = 'file/yimo/'\n",
|
||||||
|
"old = 'SGF'\n",
|
||||||
|
"new = 'sgf'\n",
|
||||||
|
"files = glob.glob(f'{filepath}*.{old}')\n",
|
||||||
|
"for f in files:\n",
|
||||||
|
" new_file =os.path.splitext(f)[0]+'.'+new\n",
|
||||||
|
" os.rename(f,new_file)"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "69712868-6786-430b-8591-f6828d781588",
|
"id": "69712868-6786-430b-8591-f6828d781588",
|
||||||
|
|||||||
Reference in new issue
Block a user