Beginner question but I wanted to handle data from multiple dictionaries in a single variable. For example:
x = {"age":"24","name":"Bob"}, {"age":"21","name":"George"}
In this case, how would I find out what "age" is in each dictionary in x, and put them in a list? This should be the desired outcome:
ages = ["24","21"]
This is what I've tried so far but raises an error:
x = {"age":24,"name":"Bob"}, {"age":21,"name":"George"}
ages = []
for y in x:
ages.append(x["age"])
TypeError: list indices must be integers or slices, not str