python 批量修改文件名代码
来源:岁月联盟
时间:2010-09-24
view plaincopy to clipboardprint?
#!/usr/bin/env python
#coding=utf-8
import os,os.path
import shutil,string
dir = C:/test
for i in os.listdir(dir):
newfile = i.replace(.,_)
oldfullfile = dir / i
newfullfile = dir / newfile
print oldfullfile
print newfullfile
shutil.move(oldfullfile,newfullfile)
print i
上一篇:python 时间方法使用详解