If you have a list of dictionaries, and need any dictionary but do not know what index that dictionary is located at, then how can you instead use the key or key value pair to find that dictionary?
The dictionary needs to retrieve as it is within the list so that the key values can still be used the same ways. Or at least be changed back like that.
I feel like this is super simple to do but I'm new to Python and absolutely cannot figure this out nor find it anywhere. I've been looking for days.
Example:
How can this be done?
Edit:
Here is what should result from that example:
The dictionary needs to retrieve as it is within the list so that the key values can still be used the same ways. Or at least be changed back like that.
I feel like this is super simple to do but I'm new to Python and absolutely cannot figure this out nor find it anywhere. I've been looking for days.
Example:
[{'colorkey':'red', 'status':'on', 'registered':'yes'},{'colorkey':'blue', 'status':'off', 'registered':'no'},{'colorkey':green', 'status':'on', 'registered':'yes'}]Assume there is no way to know what index each colorkey is located at, but you need to retrieve or get or return each dictionary that has a status on and registered yes. You need to find dictionaries not by using the index but by the colorkey key or key value pair.
How can this be done?
Edit:
Here is what should result from that example:
{'colorkey':'red', 'status':'on', 'registered':'yes'},{'colorkey':'green','status':'on','registered':'yes'}