I have list of dict where i want to extract specific dicts if they contain certain key-value pairs Ex of list of dict
[
{'value': 'def', 'key': 'abc'},
{'value': 'xyz', 'key': 'mnp'},
{'value': '456', 'key': '123'},
{'value': '234', 'key': '789'}
]
I want to extract dicts where key=abc
or key=mnp
, like that i can add multiple condition for key
What should i do here?
I tried to modify this solution but for that i have to do multiple next
, each for one condition like key=abc
, key=mnp
I can't change the list or how it's formatted because it is response of web request