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 ?

29 Answers
29

Leave a Reply

Your email address will not be published. Required fields are marked *