how to use get function in python dictionary code example

Example 1: get function in dictionary

#The get() method in  dictionary returns:
#the value for the specified key if key is in dictionary.
#None if the key is not found and value is not specified.
#value if the key is not found and value is specified.
# value is provided
print('Salary: ', person.get('salary', 0.0))

Example 2: how to get the value of key in python

print(dict.get("key"))

Example 3: how to get the value of key in python

print(dict["key"])