python 的dict

python的字典的方法,我一直以为常用的有:

dict ={"name":"test","age","22"}

dict["name"]

dict.has_key("name")

dict.keys()

dict.values()

dict.items()

今天发现有一个

dict.get("name") 返回value

dict.get("none","value") 返回设置的默认值

猜你喜欢

转载自www.cnblogs.com/miss-saber/p/9394661.html
今日推荐