Get Key from Value in Dictionary – Python
Inverting Dictionary (for Reverse Lookup)
d1 = {'a': 1, 'b': 2, 'c': 3}
val = 2
# Invert the dictionary
d2 = {v: k for k, v in d1.items()}
# Print the key corresponding to the value 2
print(d2.get(val))