WebLinuxStudy

导航

 
import os

filepaths = [];
dirpaths = [];
pathName = r'C:\anfei\json\20191128'

for root, dirs, files in os.walk(pathName):
for file in files:
file_path = os.path.join(root, file)
filepaths.append(file_path)
for dir in dirs:
dir_path = os.path.join(root, dir)
dirpaths.append(dir_path)

print(filepaths)

print(dirpaths)



posted on 2019-11-28 23:32  WebLinuxStudy  阅读(1804)  评论(0编辑  收藏  举报