Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python dictionary get

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
 
PREVIOUS NEXT
Tagged: #python #dictionary
ADD COMMENT
Topic
Name
2+5 =