# -*- coding: cp936 -*- import sys,os,string d=0; path="F://test" srcfile=os.listdir(path) for i in srcfile: src=path+"//"+i dst=path+"//"+str(d)+".txt" os.rename(src,dst) d=d+1; print src+"->"+dst
时间: 2024-10-24 22:00:05
# -*- coding: cp936 -*- import sys,os,string d=0; path="F://test" srcfile=os.listdir(path) for i in srcfile: src=path+"//"+i dst=path+"//"+str(d)+".txt" os.rename(src,dst) d=d+1; print src+"->"+dst