文件名称有不符合规范的字符可重命名或替换 import os path="C:/Users/Lenovo/Desktop/xuanzhuan" items=os.listdir(path) for item in items: print("img name=",item) itemPath=os.path.join(path,item) newName=item.replace("_", "g") newName=newName.replace("-", "g") itemNewPath=os.path.join(path,newName) os.rename(itemPath, itemNewPath)
文件批量重命名或替换命名中的某个字符
于 2022-11-15 11:08:19 首次发布