【发布时间】:2014-07-29 18:23:18
【问题描述】:
我正在寻找具有给定名称的文件夹和子文件夹的数量...在这里我正在搜索名为“L-4”的子文件夹的数量?返回零,我确定那不是真的?我错过了什么?
import os
path = "R:\\"
i = 0
for (path, dirs, files) in os.walk(path):
if os.path.dirname == "L-4":
i += 1
print i
【问题讨论】:
标签: python path operating-system