chapter 9.Dictionaries

来源:互联网 发布:中科体检软件 编辑:程序博客网 时间:2024/06/11 20:19
counts=dict()    print counts.get(name,0)

字典中的get()方法相当于下面这个代码

if name in counts:    print counts[name]else    print 0
0 0
原创粉丝点击