python/docs/stdtypes/mapping_types

mapping_types

dz / python / docs / stdtypes / mapping_types

Node Tree

Nodes

setdefault
content setdefault: If key is in the dictionary, return its value. If not, insert key with a value of default and return default. default defaults to None.
children leetcode/data_structures/hash_table (useful for defaults)
parents python/docs/stdtypes/mapping_types
hyperlink https://docs.python.org/3/library/stdtypes.html#dict.setdefault
location knowledge/python.dz:308

get
content get(key, default=None)
children leetcode/data_structures/hash_table (useful for default keyword)
parents python/docs/stdtypes/mapping_types
hyperlink https://docs.python.org/3/library/stdtypes.html#dict.get
location knowledge/python.dz:315