python字典套字典

2021-01-23 21:15

阅读:682

标签:number   count   class   min   int   highlight   ati   mil   mini   

定义字典

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字典套字典

标签:number   count   class   min   int   highlight   ati   mil   mini   

原文地址:https://www.cnblogs.com/niulang/p/12881323.html


评论


亲,登录后才可以留言!