python统计文件夹和子文件夹下的文件个数
2019-05-05 本文已影响0人
以我丶之姓
import os
file_count = 0
for dispatch, dirnames, filenames in os.path.walk('待分析目录'):
for file in filenames:
file_count += 1
print file_count
import os
file_count = 0
for dispatch, dirnames, filenames in os.path.walk('待分析目录'):
for file in filenames:
file_count += 1
print file_count