python第21篇--字典的使用
来源:互联网 发布:多空指标软件 编辑:程序博客网 时间:2024/05/29 18:55
#!/usr/bin/pythonab = {'Swaroop' :'swaroop@swaroopch.com', 'Larry' :'larry@wall.org', 'Matsumoto':'matz@ruby-lang.org', 'Spammer' :'spammer@hotmail.com'}print("Swaroop's address is",ab['Swaroop'])del ab['Spammer']print('\nThere are {0} contracts in the address-book\n'.format(len(ab)))for name,address in ab.items(): print('Contract {0} at {1}'.format(name,address))ab['Guido'] = 'guido@python.org'if "Guido" in ab: print("\nGuido's address is",ab['Guido'])
结果:
~/Note/python # ./3using_dict.py Swaroop's address is swaroop@swaroopch.comThere are 3 contracts in the address-bookContract Larry at larry@wall.orgContract Matsumoto at matz@ruby-lang.orgContract Swaroop at swaroop@swaroopch.comGuido's address is guido@python.org
阅读全文
1 0
- python第21篇--字典的使用
- Python 字典的使用
- python 字典dict 的使用
- python字典的练习使用
- Python学习9:字典dict的使用
- Python基础(十二) 字典的使用
- python中集合和字典的使用
- Python 字典(Map)的使用
- python字典与数据库的灵活使用
- python学习笔记2-字典的使用
- Python中字典get方法的使用
- python入门(八):字典的使用
- 高效使用Python字典的清单
- <Python>字典,可爱的字典
- python Dictionary字典使用
- Python-字典使用
- python-字典使用
- Python 高效使用字典
- 安卓智能地图开发与实施十四:业务数据编辑
- Android源码基础解析之SystemServer进程启动流程
- python 检测[](){}匹配小程序
- Vuforia的学习(一)---Vuforia的介绍
- ubuntu initial
- python第21篇--字典的使用
- 《FreeSWITCH: VoIP实战》:拨号计划- Dialplan
- NPM-node.js界的maven 入门
- property中的ref和value
- JAVA3.1 选择结构
- oracle数据库表对比
- BeautifulSoup
- Android7.0中文文档 --- EditText
- 杂谈 | 移动互联网创造的平行世界