python一括変更画像名(接尾辞変更可能)
452 ワード
import os
#
path = r"C:\Users\great\Desktop\111\\"
# ,
fileList = os.listdir(path)
n = 0
for i in fileList:
# ( + )
oldname = path + os.sep + fileList[n] # os.sep
#
newname = path + os.sep + ''+str(n + 0) + '.jpg'
os.rename(oldname, newname) # os rename
print(oldname, '======>', newname)
n += 1