Parsing Python dictionary with multiple objects

Anurag Patibandla anuragpatibandla7 at gmail.com
Wed Oct 15 18:57:28 CEST 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
    #print queues
    #print [(queues[j], json.get(queues[j])) for j in range(len(queues))] 
    lists = [(queues[j], json.get(queues[j])) for j in range(len(queues))] 
    #print lists
    dicts = dict(lists)
    print dicts
    print dict[0]

Print dicts works as expected giving me the combine dictionary values. But when I say dict[0]. I see the error:
TypeError: 'type' object has no attribute '__getitem__'



More information about the Python-list mailing list