首页 > 其他 > 详细

批量该文件名

时间:2016-08-31 15:18:22      阅读:202      评论:0      收藏:0      [点我收藏+]

#!/usr/bin/python
import os
path1=‘/root/model/‘
file=os.listdir(path1)
num=file.index(‘index.html‘)
del file[num]
c=str(file)
c=c.replace(‘_‘,‘.‘)
c=c.title()
c=c.replace(‘Model.Php‘,‘class.php‘)
e=list(eval(c))
b=file
a=dict(zip(b,e))
for key in a.keys():
os.rename(os.path.join(path1,key),os.path.join(path1,a[key]))

批量该文件名

原文:http://www.cnblogs.com/yang68h/p/5825803.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!