I have dictionary in following order. This dictionary is dynamically generated using from collections import defaultdict
Ref = defaultdict(<type 'list'>, {'344': [('0', '0', '136'),
('548', '136', '137'),
('548', '136', '6')],
'345': [('0', '0', '136'), ('548', '136', '137'),
('548', '136', '6'),
('742', '136', '6')]}
What I tried:
From here
Ref = {int(k):[int(i) for i in v] for k,v in Ref.items()}
but i get an error:
TypeError: int() argument must be a string or a number, not 'tuple'
What I want:
I want to convert all keys and values which are in string to integers like
Ref = defaultdict(<type 'list'>, {344: [(0, 0, 136),
(548, 136, 137),
(548, 136, 6)],
345: [(0, 0, 136), (548, 136, 137),
(548, 136, 6),
(742, 136, 6)]}