Hi the original variant was claiming a type mismatch: Traceback (most recent call last): File "<console>", line 2, in <module> TypeError: tuple indices must be integers, not str
The same with your code example. Maybe the reason is that date is not an integer as it looks like, but a string representation of it? Am Donnerstag, 2. Oktober 2014 20:03:39 UTC+2 schrieb Collin Anderson: > > Assuming "klist" is a typo, your setdefault code _should_ give you > something close to what you want, though not exactly in a table. What > happens when you try? > > I simplified your code slightly: > data = {} > for kz in kzlist: # assuming klist was a typo > data.setdefault(kz['date'], {})[kz['key']] = kz['value'] # slightly > simpler > > How are you displaying the information? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8bfcb92e-1957-4333-8b45-59c906b84112%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.