About 1,500,000 results
Bokep
- Viewed 2.5m times960edited Mar 10, 2020 at 22:51mydict = {'george': 16, 'amber': 19}print mydict.keys()[mydict.values().index(16)] # Prints george
Or in Python 3.x:
mydict = {'george': 16, 'amber': 19}print(list(mydict.keys())[list(mydict.values()).index(16)]) # Prints georgeBasically, it separates the dictionary's values in a list, finds the position of the value you have, and gets the key at that position.
More about keys() and .values() in Python 3: How can I get list of values from dict?
Content Under CC-BY-SA license Explore further
Searches you might like
Get Keys and Values from a Dictionary in Python - Stack Abuse
Get a value from a dictionary by key in Python | note.nkmk.me
Dictionaries in Python – Real Python
Search for Value in the Python Dictionary with Multiple Values for …
How to Find Key by Value in Python Dictionary | Delft Stack
Python - Access Dictionary Items - W3Schools
Python Get Dictionary Value By Key - Tutorialdeep
Python | Get key from value in Dictionary - GeeksforGeeks
Iterate through dictionary keys and values in Python
Search a list of dictionaries in Python - Stack Overflow
Python Dictionary values() Method - W3Schools
Python Dictionaries - W3Schools
Python | Find dictionary matching value in list - GeeksforGeeks
python - Searching dictionary for values - Stack Overflow
python - How can I efficiently filter a list of dictionaries by a ...
I Need To Get The Data From The File …
Find the index of a dict within a list, by matching the dict's value
python - Most efficient method to check if dictionary key exists …