Answers for "how to get all elements with same value in dictionary python"

2

print all keys having same value

dict = {"Jim": "y", "Bob": "y", "Ravioli": "n"}
In [26]: [k for k,v in dict1.items() if v == 'y']
Out[26]: ['Bob', 'Jim']
Posted by: Guest on July-31-2020

Code answers related to "how to get all elements with same value in dictionary python"

Python Answers by Framework

Browse Popular Code Answers by Language