Python
来源:互联网 发布:linux查看hba驱动版本 编辑:程序博客网 时间:2024/05/22 02:13
1. 字典的创建
1.1 创建空字典
# 1. 创建空字典dict_map = {}
1.2 直接赋值创建
# 2. 直接赋值创建person_age = {"jack": 23, "tom": 99}
1.3 字典推导
# 3. 字典推导person_age = { i:j for i,j in zip(["jack", "tom"], [23, 99]) }
1.4 dict + zip
用两个列表,使他们中对应元素成映射关系,最终生成字典。有点像plt.scatter的味道。
# 4. dict + zipperson_age = dict(zip(["jack", "tom"], [23, 99]))
参考文献
http://blog.csdn.net/csujiangyu/article/details/45176399
阅读全文
0 0
- Python
- Python
- Python
- python
- Python
- PYTHON
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- python
- Python
- 硬件工程师不会底层合适吗
- AS的签名打包
- MySQL数据库JDBC2.0操作
- Vue中引入Countly,'Countly' is not defined
- PDF编辑技巧之添加页码和编辑文字
- Python
- MATLAB 在数学建模中的应用
- CentOS 7 开放防火墙端口命令
- python正则表达式模块re
- python-易错知识(一)
- 常用PhpStorm 快捷键
- 百度地图API(3):判断地图上的点是否在 圆形 多边形 区域内
- LintCode之旋转字符串
- QT关于打印对话框