import os
a = 'test2'
path = './images/%s' % a
files = os.listdir(path)
i = 0
for file in files:
# print(path + '/' + file)
old_name = path + '/' + file
new_name = path + '/' + '%s' % i + '.png'
os.rename(old_name, new_name)
i += 1
批量修改文件名称
最新推荐文章于 2024-03-04 17:15:14 发布