Answers for "dictionary python find key from value"

-1

how to get value from key dict in python

# Get a value from a dictionary in python from a key

# Create dictionary
dictionary = {1:"Bob", 2:"Alice", 3:"Jack"}

# Retrieve value from key 2
entry = dictionary[2]

# >>> entry
# Alice
Posted by: Guest on August-15-2020
0

get a value using a dictionary key in python

print(d.get('key5', 'NO KEY'))
# NO KEY

print(d.get('key5', 100))
# 100
Posted by: Guest on November-10-2021
-3

find key by value python

print(list(d.keys())[list(d.values()).index(990)])
Posted by: Guest on May-04-2020

Code answers related to "dictionary python find key from value"

Python Answers by Framework

Browse Popular Code Answers by Language