import os
path='所需要保存处理文件所在的绝对路径';count=0;
filelist=os.listdir(path)#该文件夹下所有的文件(包括文件夹)
def rename():
global count
for files in filelist:#遍历所有文件
Olddir=os.path.join(path,files);#原来的文件路径(我选择的是输入输出相同路径,也可以用不同路径进行处理)
filename=os.path.splitext(files)[0]; #取文件名
filetype=os.path.splitext(files)[1]; #取出文件扩展名
Newdir=os.path.join(path,str(count)+filetype);#新的文件路径
os.rename(Olddir,Newdir);#重命名
count+=1;
rename();