Python get property value in dict for large dict
<p>I have a very large dictionary, like this:</p>

<pre><code>d['property1']['property2'][0]['property3']['property4']['property5']['property6']
</code></pre>

<p>I need to get <code>property6</code>. What's the simplest way for me to get this value?</p>

<p>I was thinking something like this would work:</p>

<pre><code>d.lavel6[0]['property6']
</code></pre>

<p>Unfortunately, there is no generic way to get value of key from nested dict based on levels (due to obvious reasons). But, you may write a function for your specific scenario in order to simplify it. For example:</p>

<pre><code>def get_value_from_dict(my_dict, level, key):
    return my_dict['property1']['property2'][level]['property3']['property4']['property5'][key]
</code></pre>

python