How to find a value in a list of python dictionaries?

You’d have to search through all dictionaries in your list; use any() with a generator expression:

any(d['name'] == 'Test' for d in label)

This will short circuit; return True when the first match is found, or return False if none of the dictionaries match.

Leave a Comment