Working Ninja
2017-08-31T17:38:03
Check If Value Exists in List of Dictionaries

Here's the generalized snippet:

any(dict.get('key') == search_value for dict in list)

A full example:

authors = [
    {'author': 'Michael Crichton', title: 'Jurassic Park'},
    {'author': 'C.S. Lewis', title: 'Til We Have Faces'}
]

if any(book.get('author') == 'Michael Crichton' for book in books):
    print('Found Michael Crichton!')

Or less specifically:

if any('Lewis' in book.get('author') for book in books):
    print('Found Lewis!')