How to filter files (with known type) from os.walk?
<p>I have list from <code>os.walk</code>. But I want to exclude some directories and files. I know how to do it with directories:</p>

<pre><code>for root, dirs, files in os.walk('C:/My_files/test'):
    if "Update" in dirs:
        dirs.remove("Update")
</code></pre>

<p>But how can I do it with files, which type I know. because this doesn't work:</p>

<pre><code>if "*.dat" in files:
    files.remove("*.dat")
</code></pre>
