import os
partition = input("Which drive do you want to search? ")
dirname = "XXX"
subdirname = "YYY"
for root, dirs, _fnames in os.walk(partition):
if os.path.basename(root) != dirname: continue
if not os.path.isdir(os.path.join(root, subdirname)): continue
print("Found required folder:", root)
break
相关问题 更多 >
编程相关推荐