Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

dict ;get a key of a value

myDict={"name":"PythonForBeginners","acronym":"PFB"}
print("Dictionary is:")
print(myDict)
dict_items=myDict.items()
print("Given value is:")
myValue="PFB"
print(myValue)
print("Associated Key is:")
for key,value in dict_items:
    if value==myValue:
        print(key)
Source by www.pythonforbeginners.com #
 
PREVIOUS NEXT
Tagged: #dict #key
ADD COMMENT
Topic
Name
3+7 =