On 2012-01-11, at 22:33 , Mario Gudelj wrote:
> Hi Djangoers,
>
> I have a default dict variable final_d = defaultdict(list) that looks like
> this:
>
> [(order1, [customer2, customer1]), (order2, [customer3, customer5,
> customer6]) ]
DefaultDicts are dicts, when you iterate over dicts directly you iterate over
their keys not pairs of (key, value). So your dict does not look like this, it
looks like this:
{order1: [customer2, customer1], order2: [customer3, customer5, customer6]}
and there is no way iterating over it will yield anything but its keys
Either use `dict.iteritems()` to iterate over (key, value) pairs or iterate
over it and then dereference the values corresponding to each key.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.