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 Dictionary Value by Key - GeeksforGeeks
See results only from geeksforgeeks.orgPython Dictionary get () M…
The get() method in a Python dictionary returns the value for a specified key if …
Python | Get key from value …
This code finds the key of a given value in a dictionary by using a list comprehension …
Access Dictionary Values …
There are various ways to access items in the Dictionary or call dictionary value, …
Python Dict Get Value by Ke…
Python Dict Get Value by Key Default Using get () Method. The get() method is a …
python - Get key by value in dictionary - Stack Overflow
Get Keys and Values from a Dictionary in Python - Stack Abuse
- Question & Answer
Python Dictionary get () Method - GeeksforGeeks
Python | Get key from value in Dictionary - GeeksforGeeks
Python Dictionary get() Method - W3Schools
Get a value from a dictionary by key in Python | note.nkmk.me
How To Get Dictionary Value By Key Using Python
WEBMay 28, 2024 · To get dictionary value by key in Python, use the get() function and pass the key to find its value. You can also get value by key using the index operator. Let’s find out with the examples given below.
Get keys from a dictionary by value in Python | note.nkmk.me
Python Access Dict Entries (with Best Practices) - PythonHello
Python Dictionary get() - Programiz
Accessing dict_keys element by index in Python3 - Stack Overflow
Iterate through dictionary keys and values in Python
Python - Access Dictionary Items - W3Schools
5 Best Ways to Get a Key From a Value in a Python Dictionary
Access Dictionary Values | Python Tutorial - GeeksforGeeks
How to get single value from dict with single entry?
Dictionaries in Python – Real Python
Get and Set Dictionary Key-Value Pairs Example (C#)
Python Dict Get Value by Key Default - GeeksforGeeks
getting dict key using dict value in python - Stack Overflow
python - How to get a dict key and value - Stack Overflow
- Some results have been removed