Return list of directories containing specified extension
<p>I'd like to get a list of directories below the current directory containing mp3's. </p>

<p>I can get the a list of the files easily enough using <code>os.walk</code>. I can get the full path easily enough using <code>os.path.join(os.path.abspath(root), file)</code>, but I just want a list with of the matching directories. I've tried using <code>os.path.dirname</code> and <code>os.path.pardir</code>, but all I get with them is <code>'..'</code>. </p>

<pre><code>import os
l = []
for root, dirs, files in os.walk('.'):
    for file in files:
         if file.endswith('.mp3'):
             l.append(os.path.dirname(file))
</code></pre>

<p>I'm probably missing something obvious?</p>

<p>Cheers.</p>
