📜  如何在 Python 代码示例中遍历子文件夹

📅  最后修改于: 2022-03-11 14:46:14.042000             🧑  作者: Mango

代码示例1
import os

def list_files(dir):
    r = []
    for root, dirs, files in os.walk(dir):
        for name in files:
            r.append(os.path.join(root, name))
    return r