Skip to content

Instantly share code, notes, and snippets.

@spontaneOS
Created May 27, 2019 18:11
Show Gist options
  • Save spontaneOS/9c7e3cd6c1346134e4fb091d32ed2b40 to your computer and use it in GitHub Desktop.
Save spontaneOS/9c7e3cd6c1346134e4fb091d32ed2b40 to your computer and use it in GitHub Desktop.
Use any() with list comprehension in Python
provinces_list = ['central', 'east_test', 'central_collection', 'west_gameplay']
list_keys = ('region', 'test', 'collection')
provinces_list = [p for p in provinces_list if not any(l in p.lower() for l in list_keys)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment