擅长:python、mysql、java
<p>如果你想要的只是给定目录中目录中的文件,那就太过分了。为此我要写:</p>
<pre><code>for name in os.listdir(base):
if os.path.isdir(os.path.join(base, name)):
for file in os.listdir(os.path.join(base, name)):
if os.path.isfile(os.path.join(base, name, file)):
print(os.path.join(base, name, file))
</code></pre>
<p>当然,有一些多余的<code>os.path.join</code>。在</p>