title: django remove object from list that match query filter
body: <p>At my Django application I have two lists. One list called keys and anotherone existing_keys:</p>
  <pre><code>for key in keys:
      if Files.objects.filter(file_name=Path(key).name).exists():
          existing_keys.append(key)
      while key in existing_keys:
          keys.remove(key)
          print(f'key {key} removed')
  </code></pre>
  <p>How can I now remove all entries in keys that have a match with existing_keys?
  currently im always running into the following error:</p>
  <blockquote>
  <p>raised unexpected: ValueError('list.remove(x): x not in list')</p>
  </blockquote>
  <p>Thanks in advance</p>