首页 > 其他 > 详细

字典的镶嵌

时间:2019-08-08 13:53:38      阅读:93      评论:0      收藏:0      [点我收藏+]
#字典的镶嵌
dic={"name":["apple","banana","grape"],
     "information":{1:"sweet",2:"delisious",3:"sour"},
     "hobby":"fruit",
     "age":18
    }

print(dic)
print(dic["name"][0].upper())
dic["name"].append("red grape")
print(dic)
dic["age"]=99
print(dic)
dic["information"][4]="I like it"
print(dic["information"][4]) 
#字典的K值是不可变数据类型:str,tuple,int,Bool
#而value可以是任何的数据类型

  

字典的镶嵌

原文:https://www.cnblogs.com/GZ1215-228513-Chichy/p/11320371.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!