Returns the value for a key, or a default if the key is not found.
Syntax
dict.get(key, default?)Example
Enter values below to update the example in real time.
person→print→get→Alice→None→person = {"name": "Alice", "age": 30}
print(person.get("name")) # Alice
print(person.get("email")) # None
print(person.get("email", "N/A")) # N/A