遍历目录下的文件夹名和文件名Python List Files in a Directory

https://careerkarma.com/blog/python-list-files-in-directory/

import os
path = 'D:/lxw-delete/01-员工电脑配置信息'
for root,directories,files in os.walk(path,topdown=False) :
    for name in files :
        print(os.path.join(root,name))
    for name in directories :
        print(os.path.join(root,name))
posted @ 2021-01-22 14:27  wadelin  阅读(483)  评论(0编辑  收藏  举报