Parsing Python dictionary with multiple objects

Rustom Mody rustompmody at
Wed Oct 15 18:59:12 CEST 2014

On Wednesday, October 15, 2014 10:13:18 PM UTC+5:30, Rustom Mody wrote:
> On Wednesday, October 15, 2014 9:58:49 PM UTC+5:30, Anurag Patibandla wrote:
> > First the values printed by
> > '[(queues[j], json.get(queues[j])) for j in range(len(queues))] '
> > is a list, so I tried to convert it into a dict using dict().
> > And then I tried doing dict[0] but there is an error which says:
> > 'type' object has no attribute '__getitem__'

Also there are dictionary comprehensions recently added to python:

Can generally be used if you are doing
dict(a list comprehension)

To start with though, I suggest you stay with the longer older form
until you understand how it works

More information about the Python-list mailing list