Python Accessing Values in A List of Dictionaries
问题 Say I have a List of dictionaries that have Names and ages and other info, like so: thisismylist= [ {'Name': 'Albert' , 'Age': 16}, {'Name': 'Suzy', 'Age': 17}, {'Name': 'Johnny', 'Age': 13} ] How would I go about print the following using a for loop: Albert Suzy Johnny I just cant wrap my head around this idea... 回答1: If you're just looking for values associated with 'Name', your code should look like: for d in thisismylist: print d['Name'] 回答2: If you want a list of those values: >>> [d[