python读取文件夹中的文件

def get_FileList(level,path,f_name): 
	fileList = []
	dirList = []
	files = os.listdir(path)
	dirList.append(str(level)) 
	for f in files:  
		if(os.path.isdir(path + '/' + f)):  
			if(f[0] == '.'):  
				pass  
			else:  
				dirList.append(f)
	for f in files:  
		if(os.path.isfile(path + '/' + f)):
			if(f_name in f):
				fileList.append(path + '/' +f)  
	i_dl = 0
	for dl in dirList:  
		if(i_dl == 0):  
			i_dl = i_dl + 1  
		else:
			get_FileList((int(dirList[0]) + 1), path + '/' + dl,f_name)
	return fileList

你可能感兴趣的:(Python)