遍历文件代码片段

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))

猜你喜欢

转载自www.cnblogs.com/zhangdingqu/p/12245298.html