Python作为一种脚本语言.其很适合文件级的各种操作.以下的代码能够批量删除指定目录下的所有特定类型(CSV类型)的文件. import sys, csv , operator import os import glob for i in range(0, 20): path = "C:\\Python34\\Folder_" + str(i) for infile in glob.glob( os.path.join(path, '*.csv') ): os.remove(infi…
参考:http://blog.csdn.net/zcwfengbingdongguke/article/details/13951527 代码: #!/usr/bin/python import os import re #list files def listFiles(dirPath): fileList=[] for root,dirs,files in os.walk(dirPath): for fileObj in files: fileList.append(os.path.join…