Skip to content Skip to sidebar Skip to footer

How To Loop Over A List Of Dicts And Print Values Of A Specific Key?

I'm new to Python and have (what I know to be a very simple) question. Running Python 3.4. I have a list that I need to iterate over and pull specific information out. Here is a s

Solution 1:

If I understood you correctly. You are looking for fetching a value using key from a dict.

Ex:

for i in parts:
    print(i["id"])   #or print(i.get("id"))

Output:

phwl
a06c5

MoreInfo in Python Dictionaries

Post a Comment for "How To Loop Over A List Of Dicts And Print Values Of A Specific Key?"