遍历文件代码片段

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:\國際版\AppExt\Cache\html'
bianli((rootDir))

 

你可能感兴趣的:(遍历文件代码片段)