# -*- coding: utf_8 _*_
# Author:Vi
#字典是无序的 info = {
'student001':"DIO",
'student002':"JOJO",
'student003':"Pucci",
} '''
#print(info['student003'])
info['student001'] = "屌"#对已有字典进行修改
info['student004'] = "Zepple"#添加新的
#del info['student001']#删除
#info.pop("student001")#也是删除
print(info)
info.popitem()#随即删一个
print(info)
print(info.get('student003'))#判断字典内有没有这个东西
print('student002' in info)#判断是否在内返回真假值
'''
infob = {
'student001':"Dongwei",
1:3,
2:4
}
info.update(infob)#更新字典,有的话就代替,没有就创建
c = dict.fromkeys([6,7,8],"DIO")#初始化一个新的字典,key已经写好了,后面可以赋值;
print(info.items())#将字典改成列表
print(c)
for i in info:
print(i,info[i])#字典循环方式
#多级字典嵌套及操作
game_cataloge = {
'Chinese':{
"www.didi.com":["Many resources","Good qualities"],
"www.womiao.com":["Beautiful Web","Many things"],
},
'Japan':{
"www.pixiv.com":["Splendid pictures and comic","VPN NEED"],
"www.asanews.com":["Japan local news","vpn must"],
}
}
game_cataloge['Chinese']["www.di" \
"di.com"][1] = "Bad qualities"#修改多级字典
game_cataloge.setdefault("Japan1",{"www.keroro.com"})#能取到值就返回,取不到就创建一个新的
print(game_cataloge)
#print(game_cataloge.keys())#打印keys

最新文章

  1. Git版本控制管理学习笔记1-介绍
  2. Android 笔记 day3
  3. Android ProgressBar分析及自定义ProgressBar
  4. [原创]C#应用WindowsApi实现查找(FindWindowEx)文本框(TextBox、TextEdit)。
  5. UIkit框架之UIcollection
  6. 【nodejs】使用Node.js实现REST Client调用REST API
  7. .net版ckeditor配置水印功能(转)
  8. MongoDB分布式
  9. KVO等具体实现步骤以及注意事项
  10. SpringSecurity的配置分析
  11. 关键字new与malloc函数
  12. cartographer 安装问题
  13. windows下网络丢包模拟软件(Network Emulator for Windows Toolkit)
  14. Intel 面试(就不该报外企,英语是硬伤)
  15. 练习vue(用户管理)1
  16. 搭建 Digital Ocean 服务器
  17. js getAttribute getAttributeNode
  18. 阿里云云主机添加swap分区与swap性能优化
  19. css中的block与none
  20. 使用Mondrian Virtual OLAP Cube 实现星座模型并在saiku展现分析

热门文章

  1. opencv数据结构与基本绘图
  2. wpf convert png to xaml
  3. HNU 12961 BitTorrent DP
  4. CSU 1506 Double Shortest Paths
  5. hdu 1757 矩阵连乘
  6. Draw the RGB data from kinect C++ via opengl
  7. rac重新启动遭遇ORA-01078、ORA-01565、ORA-17503、ORA-12547
  8. Codeforces 11B Jumping Jack(数学)
  9. vim 脚本之快捷注释
  10. nyoj--20--吝啬的国度(搜索dfs)