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

2011-08-08 Thread Kayode Odeyemi
> > Either way, once you have the list of the keys you want to display, print > them out once as column headings My concern is how do I print them out as columns, since writer.writerows is currently lining them out as rows (\n) Is there a function available for me to do this or do I have to const

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

2011-08-08 Thread Kayode Odeyemi
Thanks so much. This is exactly what I'm looking for. In addition, since fields is obviously a dict, I won't want to have to display it's keys repeatedly. Is there a way to get the keys once, have it displayed and used as columns, then it's values are displayed beneath it. Something like: updated

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

2011-08-07 Thread Kayode Odeyemi
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: