Python中的字典

info = {
    'name':'Xiao',
    'age':'22',
    'high':'176',
}

字典是无序的,没有下标,通过key来取值

查找:print(info["name"]))    或者  print(info.get('name'))

修改: info["name"] = "Li"

创建: info["name2"] = "Liu"

删除: del info["high"] 或者 info.pop("name") 

 

多级字典嵌套及操作:

 

info.values()  打印所有的值

 

posted @ 2019-03-12 14:16  New_Journey  阅读(414)  评论(0编辑  收藏  举报