17. 统计一下test2下的所有子目录有几个,一共有多少个文件
#encoding=utf-8
import os
dir_num=0
file_num=0
for root, dirs, files in os.walk("e:\\test2",topdown=False) :
#print u"当前目录:",root #打印目录绝对路径
for name in files :
file_num+=1
for dir in dirs:
dir_num+=1
print "file number:",file_num
print "dir number:",dir_num