Answers for "python list of dictionaries get value by key"

7

python get dict values as list

food_list=list(data.values())
print(food_list)
Posted by: Guest on February-29-2020
0

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'}
Posted by: Guest on November-10-2020
1

dict get list of values

list(d.values())
Posted by: Guest on June-12-2020

Code answers related to "python list of dictionaries get value by key"

Python Answers by Framework

Browse Popular Code Answers by Language