I have dict sample:
dictsample which have this structure dictsample.update({key: dif_k}), and dif_k have this structure dif_k.update({k:v})
dictsample:
{Object1 : { size : 14, cell: G, capacity : 35}, Object2 : { size : 14, load : 2}, Object3 : { size : 12, cell : F, load : 3, throughput : 55}, ...}
I need output like this:
{Object1 : 3, Object2 : 2, Object3 : 4, ...}
Code I have tried:
ct = {}
for key, dif_k in dictsample.iteritems():
for k, v in dif_k.iteritems():
dictcounter = k.count(k)
ct.update({key:dictcounter})
And all I got is: {Object1 : 1, Object2 : 1, Object3 : 1, ...}