I need to be able to find an item in a list
(an item in this case being a dict
) based on some value inside that dict
. The structure of the list
I need to process looks like this:
[
{
'title': 'some value',
'value': 123.4,
'id': 'an id'
},
{
'title': 'another title',
'value': 567.8,
'id': 'another id'
},
{
'title': 'last title',
'value': 901.2,
'id': 'yet another id'
}
]
Caveats: title
and value
can be any value (and the same), id
would be unique.
I need to be able to get a dict
from this list
based on a unique id
. I know this can be done through the use of loops, but this seems cumbersome, and I have a feeling that there's an obvious method of doing this that I'm not seeing thanks to brain melt.