Python Vérifiez si la clé existe
# You can use 'in' on a dictionary to check if a key exists
d = {"key1": 10, "key2": 23}
"key1" in d
# Output:
# True
SkelliBoi
# You can use 'in' on a dictionary to check if a key exists
d = {"key1": 10, "key2": 23}
"key1" in d
# Output:
# True
a_json = {"attr1":"value1"}
a_json["attr2"] = 0.75
key = "attr2"
if key in a_json:
print(a_json[key])