1 #批量修改文件名称 2 import os,re 3 path = r"C:UsersldPycharmProjects estcaseAppH5Person" 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)