下面的例子是把微信所有的表情圖片都加一下副檔名
import os
import sys
def rena():
path = 'C:\\Users\\kong\\Documents\\WeChat Files\\meowmeow\\CustomEmotions'
filenames=os.listdir( path )
for a in xrange(len(filenames)):
#print(path + os.sep + filenames[a])
os.renames(path + os.sep + filenames[a],path + os.sep + str(a)+'.gif')
if __name__=='__main__':
rena()