python 批量修改文件名
import os path=input("请输入图片目录的路径:") if path[-1]!='/': path+='/' f=os.listdir(path) print("pictures count:", len(f)) for i in range(0, len(f)): oldname=path+f[i] newname=path+'liudehua_'+str(i).rjust(4,'0')+oldname[oldname.rfind("."):] os.rename(oldname,newname)