标签:lang python 遍历文件夹 pytho walk print files port def
import os
def traverse_dir(path):
for root, dirs, files in os.walk(path):
for dir in dirs:
dir_path = os.path.join(root, dir)
print(dir_path)
traverse_dir(dir_path)
if __name__ == ‘__main__‘:
path = "D:\超编人脸"
traverse_dir(path)
标签:lang python 遍历文件夹 pytho walk print files port def
原文地址:https://www.cnblogs.com/demiao/p/14965396.html