How to access the key values in python dictionary with variables?
<p>I have a dict whose keys are numbers. It looks like this:</p>

<pre><code>{'1': 3, '2': 7, '3', 14}
</code></pre>

<p>I need to access the value of each key with a variable, but get stuck because of the quotation marks of keys. How can I do that?</p>

<p>If values is all what you want to access and the sequence doesn't matter then you can simply loop through the dict to access the values.</p>

<pre><code>my_dict = {'1': 3, '2': 7, '3': 14}
for k in my_dict:
    print my_dict[k]
</code></pre>

python dictionary