python if dictionary exists code example
Example 1: how to know if a key is in a dictionary python
dict = {"key1": 1, "key2": 2}
if "key1" in dict:
Example 2: contanskey in python
d = {
"a": 1,
"b": 2
}
# To check if key is there in the dictionary
if "a" in d:
print("Found")