对文件夹中的所有文件进行重命名
import os
folderPath = r"D:\folderPath"
fileList = os.listdir(folderPath)
for i in range(len(fileList)):
old_name = os.path.join(folderPath, fileList[i])
new_name = os.path.join(folderPath, str(i + 1) + ".jpg")
os.rename(old_name, new_name)