脚本-获取文件夹下所有文件

# 获取文件夹下所有文件

# _*_ 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

 

posted @ 2019-10-22 16:31  小学弟-  阅读(509)  评论(0编辑  收藏  举报