python 批量修改文件名
作者:互联网
import os import sys def rename(): path=input("请输入路径:") count=1 filelist=os.listdir(path) for files in filelist: ori_dir=os.path.join(path,files) if os.path.isdir(ori_dir):#跳过目录 continue now_dir = os.path.join(path, 'SteroSR_x4_epoch'+str(count)+'.pth') os.rename(ori_dir,now_dir) count+=1 print("一共修改了"+str(count-1)+"个文件") rename()
标签:count,rename,批量,文件名,python,ori,path,os,dir 来源: https://www.cnblogs.com/tingtin/p/14092256.html