Check for existence of a key in dictionary and retrieve its value if present.
dictionary = { "key": "value" } # checking for the presence and key and getting the value wanted = None if "key" in dictionary: wanted = dictionary["key"] # Simpler version wanted = dictionary.get("key", None)