改名移动批量文件 shutil.copy
import glob import os import shutil filePath = 'F:/project/Breast/InBreast/INBreast/imgout/' newFilePath = 'F:/project/Breast/InBreast/INBreast/imgout1/' filename = os.listdir(filePath) for i in filename: jpg = os.path.join(filePath, i) print(i[0:8]) # shutil.copy(newFilePath+'/'+i,filePath+'/'+i) shutil.copy(filePath + '/' + i, newFilePath + '/' + i[0:8]+'.png') # 将filepath里面的所有图片拷贝到newfilepath里面