Using Python, I have created a list that is indexed by a tuple:
return values[(a, b)]
However, sometimes I want to pass in (a, _) where I don’t care what the value of b is and receive a list of all the possible indices.
Such as:
values[(dog, _)] => returns [(dog, Mike), (dog, Sam), (dog, Edward)]
Is this possible in Python?
You must use the exact value of a key to index a dictionary.
To find multiple keys, you need to loop over them: