DEV Community

Cristian Vargas
Cristian Vargas

Posted on

Answer: how to use python "get()" for keys deeper than first level of dictionary keys?

You can pass a default value as the second argument to dict.get(), like this:

dict.get('keyB_1', {}).get('keyB_2', {}).get('keyB_3')

Top comments (0)