#批量修改文件名称

 1 #批量修改文件名称
 2 import os,re
 3 path = r"C:\Users\ld\PycharmProjects\testcase\AppH5\Person"
 4 fileName_list = os.listdir(path)
 5 for key,value in enumerate(fileName_list):
 6     if re.match('\d',value):
 7         rename_value = ''.join((path,'\\',"BAT_",value))
 8         value = os.path.join(path,value)
 9         print(value,rename_value)
10         os.renames(value,rename_value)

 

posted @ 2020-06-19 11:22  raykeyor  阅读(158)  评论(0编辑  收藏  举报