本地E盘上有一个why文件夹,why文件夹下有3个文件夹,分别是one,two,three,这三个文件夹下面分别有自己的txt文件:
import os
import os.path
rootdir="E:why"
for zhu,ci,files in os.walk(rootdir):
for f in files:
print os.path.join(zhu,f)
输出为:
E:whyone1.1.txt
E:whyone1.2.txt
E:why hreewa.txt
E:why wo2.1.txt
E:why wo2.2.txt