python 字典基礎操作

update()方法 dict.update(dict2) dict={「name」:「Zara」,"Age":7} dict2={"Sex":"female"} dict.update(dict2) print dict 輸出: {「Age」:7,「Name」:"Zara","Sex":"female"} 訪問字典裏的值 print dict["Name"] 輸出: Zara 字典添加鍵或重新賦
相關文章
相關標籤/搜索