Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python dictonary set default

#!/usr/bin/python

dict = {'Name': 'Zara', 'Age': 7}
print "Value : %s" %  dict.setdefault('Age', None)
print "Value : %s" %  dict.setdefault('Sex', None)

>>Value : 7
>>Value : None
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #python #dictonary #set #default
ADD COMMENT
Topic
Name
1+9 =