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: http://legacy.python.org/dev/peps/pep-0274/ 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 -- https://mail.python.org/mailman/listinfo/python-list