# 获取文件夹下所有文件
# _*_ coding: utf-8 _*_ import os path = r'E:log' def get_filelist(): Filelist = [] for home, dirs, files in os.walk(path): for filename in files: # 文件名列表,包含完整路径 Filelist.append(os.path.join(home, filename)) # # 文件名列表,只包含文件名 # Filelist.append(filename) return Filelist