python 修改 文件名称

import os

def rename_func(path):
    for file in os.listdir(path):
        fileNew = file.lower()
        print("Old:", file, "New", fileNew)
        if(fileNew != file):
            os.rename(path + file, path + fileNew)

path2 = "C:\\Program Files\\MATLAB\\R2014b\\toolbox\\gatbx\\Test_fns\\"


rename_func(path2)

猜你喜欢

转载自www.cnblogs.com/tangjicheng/p/9116345.html