擅长:python、mysql、java
<p>基本上,听起来你想找到一组特定的子文件夹,所以使用<code>sets</code>是很自然的,这使得这是一件相当容易的事情。在检查相等性时,它们的使用也会删除顺序依赖关系。在</p>
<pre><code>import os
start_path = '/'
target = 'zeFolder'
siblings = ['brotherOne', 'brotherTwo']
sought = set([target] + siblings)
for root, dirs, files in os.walk(start_path):
if sought == set(dirs):
print('found')
</code></pre>