三层文件夹的文件遍历

 1 import os
 2 fin = 'D:\\data_sex\\'
 3 fout = 'D:\\data_sex\\'
 4 print(os.listdir(fin))
 5 for file in os.listdir(fin):
 6     file_fullname = fin + '\\' +file
 7     print(file_fullname)
 8     for file2 in os.listdir(file_fullname):
 9         file_fullname2 = file_fullname + '\\' + file2
10         print(file_fullname2)
11         for file3 in os.listdir(file_fullname2):
12             file_fullname3 = file_fullname2 + '\\' + file3
13             print(file_fullname3)

posted @ 2018-01-16 15:08  ayew  阅读(420)  评论(0编辑  收藏  举报