import os ,os.path ,time
folder = "D:\\Python3.8\\theyn/text"
os.chdir(folder)
names = os.listdir(folder)
for name in names:
# print(name)
# new_name = name.replace("txt",'jpg')
new_name = name.replace("jpg",'txt')
# new_name = name+".txt"
os.renames(name,new_name)
Python批量修改文件名
最新推荐文章于 2023-06-09 17:04:11 发布