Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

best way to access nested key in python

def safeget(dct, *keys):
    for key in keys:
        try:
            dct = dct[key]
        except KeyError:
            return None
    return dct
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #access #nested #key #python
ADD COMMENT
Topic
Name
8+3 =