i have the following code:
#!/usr/bin/python
farm_sub_count = [[['Farm', u'Red Hat Enterprise Linux for Virtual Datacenters with Smart Management, Premium'], 2], [['Farm', u'Red Hat Enterprise Linux for Virtual Datacenters with Smart Management, Standard'], 2], [['Farm', u'Red Hat Enterprise Linux for Virtual Datacenters with Smart Management, Premium'], 1]]
from collections import defaultdict
d = defaultdict(lambda: defaultdict(int))
for (a, b), c in farm_sub_count:
d[a][b] += c
print( dict(d) )
print( dict.__repr__(d) )
i am getting the following output:
{Farm - defaultdict(<type 'int'>, {u'Red Hat Enterprise Linux for Virtual Datacenters with Smart Management, Standard': 2, u'Red Hat Enterprise Linux for Virtual Datacenters with Smart Management, Premium': 3})
i dont want to see the type ,i just want to see the date:
{Farm: {u'Red Hat Enterprise Linux for Virtual Datacenters with Smart Management, Standard': 2, u'Red Hat Enterprise Linux for Virtual Datacenters with Smart Management, Premium': 3})}
i looked at other thrieds ,and they recomended to convert it to dic:
print( dict(d) )
or
print( dict.__repr__(d) )
i am still getting the type