Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

using .get() for deep dictionary

example_dict['key1'] = {'attr1':1,'attr2':2}
# You can get multiple times for nested dicts, 
# by returning an empty dict if not found:
example_dict.get('key1', {}).get('attr1')
 
PREVIOUS NEXT
Tagged: #deep #dictionary
ADD COMMENT
Topic
Name
1+6 =