python遍历文件夹
import os def list_dir_files(dir_abs): allfiles = [] for root,dirs,files in os.walk(dir_abs): print('-----------------------------------') print('root:', root) print('dirs:', dirs) print('files:', files) for filespath in files: allfiles.append(os.path.join(root,filespath)) return allfiles