Inverse dictionary lookup - Python
Posted
by RadiantHex
on Stack Overflow
See other posts from Stack Overflow
or by RadiantHex
Published on 2010-04-02T19:18:27Z
Indexed on
2010/04/02
19:23 UTC
Read the original article
Hit count: 227
python
|dictionary
Hi there,
is there any straight forward way of finding a key by knowing the value within a dictionary?
all I can think of is this:
key = [i for key,value in dict.items() if value=='value' ][0]
Any ideas?
© Stack Overflow or respective owner