python字典套字典
Posted 牛郎
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python字典套字典相关的知识,希望对你有一定的参考价值。
定义字典
familyinfo = { "family name":"Python", "family structure":[ {"name":"Taro", "age":32, "sex":"male"}, {"name":"Hanako", "age":31, "sex":"female"}, {"name":"Ichiro", "age":5, "sex":"male"} ], "address":[ {"country":"Japan"}, {"administrative_area":"Tokyo"}, {"locality":"Chuohku"} ], "phone number":"03-0000-0000" }
想要打印“Taro”的话
print(familyinfo["family structure"][0]["name"])
以上是关于python字典套字典的主要内容,如果未能解决你的问题,请参考以下文章