Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

glom safely interact with dictionary

def deep_get(dictionary, keys, default=None):
    return reduce(lambda d, key: d.get(key, default) if isinstance(d, dict) else default, keys.split("."), dictionary)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #glom #safely #interact #dictionary
ADD COMMENT
Topic
Name
3+7 =