Python: removing multiple values from a list where using filters is more awkward
<p>Trying to create a list of files with multiple extensions over which to iterate. Most of the answers on stack overflow involve filtering using lambda but I'm not sure how this can work in this case (just because of the way the iteration would be set up). So far I have</p>

<pre><code>import fnmatch

excluded = ['*.py', '*.py~']

fileNames = []

for fileName in os.listdir('.'):
    fileNames.append(fileName)
    print fileNames

for p in excluded:
    if fnmatch.fnmatch(fileName, p):
        fileNames.remove(fileName)
        print fileNames
</code></pre>

<p>Obviously the problem is that list.remove only removes the first instance and not all instances. What do you reckon would be the most efficient way to solve this problem?</p>

<p>Thanks!</p>
