Getting a list value from key/value pair

Kayode Odeyemi dreyemi at gmail.com
Sun Sep 18 06:30:06 EDT 2011


On Sun, Sep 18, 2011 at 11:22 AM, Vincent Vande Vyvre <
vincent.vandevyvre at swing.be> wrote:

> **
> Le 18/09/11 11:39, Kayode Odeyemi a écrit :
>
> items = {'fees':[('status','pending'), ('timeout',60)],
> 'hostel':[('status',
>  'pending'), ('timeout','120')]}
>
> Like that:
>
> # -*- coding: utf-8 -*-
>
>
> items = {'fees':[('status','pending'), ('timeout',60)],
> 'hostel':[('status',
>  'pending'), ('timeout','120')]}
>
> for key, value in items.iteritems():
>     print "\n {0}".format(key)
>     for val in value:
>         print "\t{0}:  {1}".format(val[0], val[1])
>
> for python 2.x
>

Thank you very much :)


-- 
Odeyemi 'Kayode O.
http://www.sinati.com. t: @charyorde
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110918/d7e179a5/attachment-0001.html>


More information about the Python-list mailing list