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 python - Get key by value in dictionary - Stack Overflow
Access Dictionary Values | Python Tutorial - GeeksforGeeks
Python Get Dictionary Value by Key - GeeksforGeeks
Get Keys and Values from a Dictionary in Python - Stack Abuse
Python - Access Dictionary Items - W3Schools
Get a value from a dictionary by key in Python | note.nkmk.me
- People also ask
Key-Value Operations with Dictionaries - Dive Into …
WEBMay 3, 2024 · Learn how to get, convert, check and delete keys and values from a Python dictionary. See examples of using keys(), values(), in operator, del statement and pop() method.
Python Dictionary Find Key By Value
WEBApr 9, 2024 · Learn how to find keys by value in Python dictionaries using loop, dictionary comprehension, and filter. See examples of extracting product names, user roles, and price ranges based on values.
Iterate through dictionary keys and values in Python
Python Dictionary (With Examples) - Programiz
Dictionaries in Python – Real Python
WEBLearn how to define, access, and manipulate dictionaries, a composite data type that maps keys to values. See examples, methods, and restrictions of dictionaries in Python.
Python | Get key from value in Dictionary - GeeksforGeeks
How to access a Dictionary Key by Index in Python | bobbyhadz
Get keys from a dictionary by value in Python | note.nkmk.me
Python Dictionary keys() (With Examples) - Programiz
Python Dictionary - Python Tutorial
How To Get Dictionary Value By Key Using Python - Tutorialdeep
dictionary - getting dict key using dict value in python - Stack …
Python Dictionary keys() Method - W3Schools
5 Best Ways to Get a Key From a Value in a Python Dictionary
- Some results have been removed