Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

get dictionary value python

myDict = {
	"comment": "A like if you love learning python with grepper!"
}
myDict["comment"] #retrieves comment if found. Otherwise triggers error
#or if not sure if key is in dictionary, avoid exiting code with error.
myDict.get("comment") #retrieves comment or None if not found in dict
Source by note.nkmk.me #
 
PREVIOUS NEXT
Tagged: #dictionary #python
ADD COMMENT
Topic
Name
7+8 =