标签:getcwd path name python file list class 重命名 rename
import os
path = os.getcwd()
os.chdir(path)
file_name = os.listdir(path)
# print file_name
for each in file_name:
if (‘WC‘ in each) and (‘WCT‘ not in each):
name_rew = ‘WCT‘ + each[2:]
os.rename(each,name_rew)
print ‘%s rename to %s‘ %(each,name_rew)
else:
print ‘the file name is %s\t,don\‘t need to rename‘ %(each)
标签:getcwd path name python file list class 重命名 rename
原文地址:http://www.cnblogs.com/hester/p/7910322.html