擅长:python、mysql、java
<p>如果您正在寻找<strong>find</strong>的Python实现,这是我经常使用的一个方法:</p>
<pre><code>from findtools.find_files import (find_files, Match)
# Recursively find all *.sh files in **/usr/bin**
sh_files_pattern = Match(filetype='f', name='*.sh')
found_files = find_files(path='/usr/bin', match=sh_files_pattern)
for found_file in found_files:
print found_file
</code></pre>
<p>所以我用它做了一个PyPI<a href="https://pypi.python.org/pypi/findtools/" rel="noreferrer">package</a>,还有一个<a href="https://github.com/ewiger/findtools" rel="noreferrer">GitHub repository</a>。我希望有人发现它可能对这段代码有用。</p>