[Tutor] How to get the keys of a dict inside a dict. ValueError: too many values to unpack

Kayode Odeyemi dreyemi at gmail.com
Sun Aug 7 17:37:24 CEST 2011


Hello all,

Please I need help figuring out this permutation.

I have a dict like this:

x = "{'pk': 1L, 'model': 'trans', 'fields': {'updated': 2011, 'tel':
3456}", "{'pk': 2L, 'model': 'trans2', 'fields': {'updated': 2011, 'tel':
34510}";

#loop through and get the keys of each
for k,v in x:
    keys = dict(x).keys()
print keys

I get ValueError: too many values to unpack

Any help will be much appreciated.

Regards


-- 
Odeyemi 'Kayode O.
http://www.sinati.com. t: @charyorde
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110807/9e11d6c7/attachment.html>


More information about the Tutor mailing list