[Python] Safe method to get value of nested dictionary

Discussão em 'Python' iniciado por Stack, Abril 17, 2025.

  1. Stack

    Stack Membro Participativo

    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 ?

    Continue reading...

Compartilhe esta Página