# encoding: utf-8
import os
import os.path
rootdir = r'D:\game'
for parent, dirnames, filenames in os.walk(os.getcwd()):
for index in range(len(filenames)):
filename = filenames[index]
if ".jpg" in filename:
newName = "haoyou%i.jpg" % index
os.rename(os.path.join(parent, filenames[index]), os.path.join(parent, newName))
网友评论