I have a nested dictionary. Is there only one way to get values out safely?
try:
example_dict['key1']['key2']
except KeyError:
pass
Or maybe python has a method like get()
for nested dictionary ?
I have a nested dictionary. Is there only one way to get values out safely?
try:
example_dict['key1']['key2']
except KeyError:
pass
Or maybe python has a method like get()
for nested dictionary ?