Parsing Python dictionary with multiple objects

Anurag Patibandla anuragpatibandla7 at gmail.com
Wed Oct 15 13:00:38 EDT 2014


keys = json.keys()
order = list(keys)
q1 = int(round(len(keys)*0.2))
q2 = int(round(len(keys)*0.3))
q3 = int(round(len(keys)*0.5))
b = [q1,q2,q3]
n=0
for i in b:
    queues = order[n:n+i]
        
    n = n+i
    lists = [(queues[j], json.get(queues[j])) for j in range(len(queues))] 
    
    dicts = dict(lists)
    print dicts
    print dict[0]

print dicts works as expected. It gives me the entire dictionary. But when I do dicts[0], there is the following error:
'type' object has no attribute '__getitem__'



More information about the Python-list mailing list