I currently have a list of dictionaries like this:
[ {'id': 'ABBA', 'num': '10 3 5 1'}, {'id': 'ABAC', 'num': '4 5 6 20'}]
How can I change the value associated with the num key from a string to a list and iterate that over the list of dictionaries? Like this:
[ {'id': 'ABBA', 'num': ['10','3','5','1']}, {'id': 'ABAC', 'num': ['4', '5', '6' '20']}]
I know there are similar questions out there on how to loop through a list of dictionaries and changing a string to a list, but I can't seem to put all of these together.
I've tried:
for i in list_of_dictionaries:
for id, num in i.items():
for val in num:
val = val.split()
print(val)
print(list_of_dictionaries)
But I get [] for val and then the same unchanged list of dictionaries back.