遍历文件代码片段

import os
#https://jingyan.baidu.com/article/a3761b2bc78d731576f9aaa5.html
def get_data(path):
    print(path)



def bianli(rootDir):
    for root,dirs,files in os.walk(rootDir):
        for file in files:
            path=os.path.join(root,file)
            # print(path)
            get_data(path)
        for dir in dirs:
            bianli(dir)
rootDir='D:國際版AppExtCachehtml'
bianli((rootDir))
原文地址:https://www.cnblogs.com/zhangdingqu/p/12245298.html