Parsing Python dictionary with multiple objects

anuragpatibandla7 at gmail.com anuragpatibandla7 at gmail.com
Tue Oct 14 11:57:56 EDT 2014


I have a dictionary that looks like this:
{"1":{"Key1":"Value1", "Key2":"Value2", "Key3":"Value3"}, 
"2":{"Key1":"Value1", "Key2":"Value2", "Key3":"Value3"}, 
"3":{"Key1":"Value1", "Key2":"Value2", "Key3":"Value3"}, 
"4":{"Key1":"Value1", "Key2":"Value2", "Key3":"Value3"}}

Now if I have 100 objects like these and I need to split them into 3 smaller dicts in a ratio 2:3:5, how could I do that?
I tried using numpy.random.choice(), but it says it needs to be a 1-d array.

Can someone please help with this?
Thanks



More information about the Python-list mailing list