请解释这段代码的结论
Please explain the conclusion of this code
你能告诉我变量 "count" 到底是什么吗?
count = 0
for (r,d,f) in
os.walk(os.getcwd()):
count += 1
print("a =", count)
#a = 124
help(os.walk)
会告诉你:
Directory tree generator.
For each directory in the directory tree rooted at top (including top itself, but excluding '.' and '..'), yields a 3-tuple dirpath, dirnames, filenames
因此,count
计算当前工作目录(包括)中的文件夹(也包括嵌套文件夹)。
你能告诉我变量 "count" 到底是什么吗?
count = 0
for (r,d,f) in
os.walk(os.getcwd()):
count += 1
print("a =", count)
#a = 124
help(os.walk)
会告诉你:
Directory tree generator.
For each directory in the directory tree rooted at top (including top itself, but excluding '.' and '..'), yields a 3-tuple
dirpath, dirnames, filenames
因此,count
计算当前工作目录(包括)中的文件夹(也包括嵌套文件夹)。