DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
get key from value dictionary py
dict = {1: 'a', 2: 'b'} value = 'a' key = [x for x in dict.keys() if dict[x] == value][0]
Source by note.nkmk.me #
PREVIOUS
NEXT
Tagged:
#key
#dictionary
#py
ADD COMMENT
Topic
COMMENT
Name
4+1 =
Submit