python 获取文件夹下所有文件包含子目录文件

1
2
3
4
5
6
7
8
9
10
def get_all_files(dir):
    files_ = []
    list_ = os.listdir(dir)
    for i in range(0, len(list_)):
        path = os.path.join(dir, list_[i])
        if os.path.isdir(path):
            files_.extend(get_all_files(path))
        if os.path.isfile(path):
            files_.append(path)
    return files_

  

本文作者:🦉. 城南

本文链接:https://www.cnblogs.com/dockers/p/10496179.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   🐳.城南  阅读(9428)  评论(1编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起