Python get property value in dict for large dict -


i have large dictionary, this:

d['property1']['property2'][0]['property3']['property4']['property5']['property6'] 

i need property6. what's simplest way me value?

i thinking work:

d.lavel6[0]['property6'] 

unfortunately, there no generic way value of key nested dict based on levels (due obvious reasons). but, may write function specific scenario in order simplify it. example:

def get_value_from_dict(my_dict, level, key):     return my_dict['property1']['property2'][level]['property3']['property4']['property5'][key] 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -