Search
 
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
Name
8+9 =