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]
 
PREVIOUS NEXT
Tagged: #key #dictionary #py
ADD COMMENT
Topic
Name
1+9 =