Getting a list value from key/value pair
<p>If I have a list with key/value pair, how do I get the value of the key?</p>

<p>I'm working with this code snippet:</p>

<pre><code>&gt;&gt;&gt; items = {'fees':[('status','pending'), ('timeout',60)], 'hostel':[('status',
 'pending'), ('timeout','120')]}
&gt;&gt;&gt; print [items[i] for i in items.keys()]
[[('status', 'pending'), ('timeout', '120')], [('status', 'pending'), ('timeout'
, 60)]]
&gt;&gt;&gt;
</code></pre>

<p>I'm expecting this:</p>

<pre><code># get timeout. I know this line is wrong
timeout = items.get(i)

# Put the transaction item in a queue at a specific timeout
# period

transaction_queue(i, block, timeout)

def transaction_queue(item, block=False, timeout):
    return queue.put(item, block, timeout)
</code></pre>

<p>Thanks for helping out.</p>

<p>I can't answer until 7 hours as at writing.</p>

<p>So, the answer is:</p>

<pre><code>&gt;&gt;&gt; for key, value in items.iteritems():
...     for val in value:
...             print "\t{0} : {1}".format(val[0], val[1])
...
        status : pending
        timeout : 120
        status : pending
        timeout : 60
&gt;&gt;&gt;
</code></pre>

<p>Thanks to Vincent Vande Vyvre</p>
