# -*- 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-12-31 05:15:37
# -*- 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