import os,sys
dir = 'C:\\Users\\............'
filenames=os.listdir(dir)
for a in xrange(len(filenames)):
dir = 'C:\\Users\\............'
filenames=os.listdir(dir)
for a in xrange(len(filenames)):
os.rename(dir+os.sep+filenames[a],(dir+os.sep+filenames[a]).split(".")[0]+"new"+'.txt')
#coding:utf-8
import os
movie_name = os.listdir('./movies')
for temp in movie_name:
num = temp.rfind(']')#找到最右边]的下标
# new_name = '[可可可可]' + temp
new_name = temp[num+1:]
os.rename('./movies/'+temp,'movies/'+new_name)