文件名修改
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/e13479b7877ff3a26fa782def876b2aa.png)
import os
import glob
import shutil
dir=r"E:\deeplearning\mypro\360Images"
new_dir_name=r"E:\deeplearning\mypro\txt"
for path in os.listdir(dir):
path1=os.path.join(dir,path)
for mypath in os.listdir(path1):
ppp=os.path.join(path1,mypath)
old_name=os.path.basename(ppp)
new_name=path+"_"+os.path.basename(old_name)
ori_dir=os.path.join(path1,mypath)
if not os.path.exists(new_dir_name):
os.makedirs(new_dir_name)
get_dir=os.path.join(new_dir_name,new_name)
print(get_dir)
shutil.copy(ori_dir,get_dir)