Parsing Python dictionary with multiple objects
Anurag Patibandla
anuragpatibandla7 at gmail.com
Tue Oct 14 23:40:40 EDT 2014
Thanks for the response.
Here is the code that I have tried.
from operator import itemgetter
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
for j in range(len(queues)):
q = (queues[j], json.get(queues[j]))
print q
By this I am able to get the 3 smaller dicts I want, but can you help me assign them to 3 variables?
The dicts need not be ordered but it would be better if they are ordered.
Thanks
More information about the Python-list
mailing list