python check if dict contains all keys code example
Example 1: python test if list of dicts has key
>>> lod = [{1: "a"}, {2: "b"}]
>>> any(1 in d for d in lod)
True
>>> any(3 in d for d in lod)
False
Example 2: python dictionary contains key
if key in dictionary:
print(True)