import os
# 图片存放的路径
path = "E:/renumber/"
# 遍历更改
num = 1
for file in os.listdir(path):
os.rename(os.path.join(path,file),os.path.join(path,'{}'.format(num))+".jpg") # 结果为1.jpg...
# os.rename(os.path.join(path,file),os.path.join(path,'%03d'%(num))+".jpg")# 结果为001.jpg...
num = num + 1
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)