how to get value in a dictionary with list code example
Example 1: python get dict values as list
food_list=list(data.values())
print(food_list)
Example 2: list of dict values
list(d.values())
Example 3: get dictionary in array python by value
>>> dicts = [
... { "name": "Tom", "age": 10 },
... { "name": "Mark", "age": 5 },
... { "name": "Pam", "age": 7 },
... { "name": "Dick", "age": 12 }
... ]
>>> next(item for item in dicts if item["name"] == "Pam")
{'age': 7, 'name': 'Pam'}