Python 批量修改文件夹名称
修改为:
# -*- coding: utf-8 -*- import os, sys,re path=u"E:\\C#网络编程基础" dirs=os.listdir(path) for dir in dirs: if os.path.isdir(dir) : newDir= dir.split(u"】")[1].encode("gb2312") #print newDir os.rename(dir,newDir) for dir in dirs: if os.path.isdir(dir) : print dir