Renomeio do arquivo em lote python
def batch_rename(dir_path):
itemlist = os.listdir(dir_path)
# 获取目录文件列表
for item in itemlist:
# 连接成完整路径
item_path = os.path.join(dir_path, item)
print(item_path)
# 修改文件名
if os.path.isfile(item_path):
splitext = os.path.splitext(item_path)
os.rename(item_path, splitext[0] + "-ShowMeAI" + splitext[1])
Allen Chiu