Professional Documents
Culture Documents
Attributes of Dictionary
Attributes of Dictionary
Attributes of Dictionary
get: Retrieves the value for a given key, or a default value if the key is
not present. .get( key )
pop: Removes and returns the value for a given key, or a default value if
the key is not present. .pop( key )
popitem: Removes and returns a random (key, value) pair from the
dictionary. .popitem()
fromkeys: Creates a new dictionary with keys from an iterable and a common
initial value.
setdefault: Retrieves the value for a given key or sets it to a default value
if not present. .setdefault( key )
update: Updates the dictionary with key-value pairs from another
dictionary or iterable.