My question is very similar to this one, except I have a dictionary of lists and I\'m interested in changing both the key value and all elements in every list form str
d = {'1':'145' , '2':'254' , '3':'43'}
d = {int(k):int(v) for k,v in d.items()}
>>> d
{1: 145, 2: 254, 3: 43}
for lists in values
>>> d = { '1':['1', '2', '3', '4'] , '2':['1', '4'] , '3':['43','176'] }
>>> d = {int(k):[int(i) for i in v] for k,v in d.items()}
in your case:
coautorshipDictionary = {int(k):int(v) for k,v in json.load(json_data)}
or
coautorshipDictionary = {
int(k):[int(i) for i in v] for k,v in json.load(json_data)}