title: Can I delete multiple file extensions at same time in python
body: <p>Is there way to add multiple extensions (e.g. pattern = ('<em>.txt' or '</em>.doc')</p>
  
  <pre><code>import os, fnmatch
  def find_files(directory, pattern):
  
      for root, dirs, files in os.walk(directory):
  
          for basename in files:
              if fnmatch.fnmatch(basename, pattern):
                  filename = os.path.join(root, basename)
  
                  yield filename
  
  def find_files_to_list(directory, pattern):
  
  wanted_files = find_files_to_list('/original_project/', '*.html')
  
  for filename in find_files('/copy_project/', '*'):
  
      if filename not in wanted_files:
          os.remove(filename)
  
      file_list = []
      for root, dirs, files in os.walk(directory):
          for basename in files:
              if fnmatch.fnmatch(basename, pattern):
                  filename = os.path.join(root, basename)
                  file_list.append(filename)
  
      return file_list
  
  wanted_files = find_files_to_list('/original_project/', '*.html')
  
  for filename in find_files('/copy_project/', '*'):
  
      if filename not in wanted_files:
          os.remove(filename)
  </code></pre>