Python list of dictionaries search

Assume I have this:

[
  {"name": "Tom", "age": 10},
  {"name": "Mark", "age": 5},
  {"name": "Pam", "age": 7}
]

and by searching “Pam” as name, I want to retrieve the related dictionary: {name: "Pam", age: 7}

How to achieve this ?

Leave a Comment