改为:
dict.get(key)
dict = {‘Name’: ‘Runoob’, ‘Age’: 27}
print “Value : %s” % dict.get(‘Age’)
print “Value : %s” % dict.get(‘Sex’, “Not Available”)
版权声明:本文为weixin_42210195原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
改为:
dict.get(key)
dict = {‘Name’: ‘Runoob’, ‘Age’: 27}
print “Value : %s” % dict.get(‘Age’)
print “Value : %s” % dict.get(‘Sex’, “Not Available”)