Python查找文件
import os import collections def getfile(dir_fiile): allFileNum = 0 baseUrl=dir_fiile list = os.listdir(baseUrl) filelist = [] for i in range(0, len(list)): #遍历 path = os.path.join(baseUrl,list[i]) allFileNum = allFileNum + 1 if os.path.isfile(path): filelist.append(list[i]) else: print "没有找到测试报告" return filelist[-2]