Python如何列出目录下的所有文件 更新于 2016-05-14 | 分类于 python | https://taizilongxu.gitbooks.io/stackoverflow-about-python/content/39/README.html#123from os import listdirfrom os.path import isfile, joinonlyfiles = [ f for f in listdir(mypath) if isfile(join(mypath,f)) ] 123456from os import walkf = []for (dirpath, dirnames, filenames) in walk(mypath): f.extend(filenames) break