I have a list of dictionaries as follows:
list = [ { 'a':'1' , 'b':'2' , 'c':'3' }, { 'd':'4' , 'e':'5' , 'f':'6' } ]
How do I convert the values of each dictionary inside the list to int/float?
So it becomes:
list = [ { 'a':1 , 'b':2 , 'c':3 }, { 'd':4 , 'e':5 , 'f':6 } ]
for sub in the_list:
for key in sub:
sub[key] = int(sub[key])
Gives it a casting as an int instead of as a string.