Access nested key-values in Python dictionary
<p>I have the following dictionary structure and Iam trying to access the <code>total_payments</code> field. It is like accessing key of keys in Python dictionary:</p>

<pre><code>d = {'METTS MARK': {'bonus': 600000,
            'deferral_payments': 'NaN',
            'deferred_income': 'NaN',
            'director_fees': 'NaN',
            'email_address': 'a@b.com',
            'exercised_stock_options': 'NaN',
            'expenses': 94299,
            'from_messages': 29,
            'from_poi_to_this_person': 38,
            'from_this_person_to_poi': 1,
            'loan_advances': 'NaN',
            'long_term_incentive': 'NaN',
            'other': 1740,
            'poi': False,
            'restricted_stock': 585062,
            'restricted_stock_deferred': 'NaN',
            'salary': 365788,
            'shared_receipt_with_poi': 702,
            'to_messages': 807,
            'total_payments': 1061827,
            'total_stock_value': 585062}}
</code></pre>

<p>It rather seems that values of your dictionay are dict, and not that the keys are dict.
So you can just access as follows:</p>

<pre><code>your_dict[KEY1]['total_payments']
</code></pre>

<p>Please also anonymize the email address in your example.</p>

python dictionary