python创建关联数组(字典)的方法
作者:重负在身 时间:2021-11-22 06:51:18
本文实例讲述了python创建关联数组(字典)的方法。分享给大家供大家参考。具体分析如下:
关联数组在python中叫字典,非常有用,下面是定义字典的两种方法
# Dictionary with quoted or variable keys
d1 = {"name":"donuts","type":"chocolate","quantity":10}
# Dictionary with fixed keys
d2 = dict(name="donuts",type="chocolate",quantity=10)
assert d1 == d2
希望本文所述对大家的Python程序设计有所帮助。
标签:python,关联数组,字典
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
“Unable to read local eventlog (reason:事件日志文件已在读取时间更改)”解决办法
2009-08-27 13:12:00
HTTP状态码
2009-09-21 12:46:00
如何把图片也存到数据库中去?
2009-11-06 13:56:00
实现文字放大效果Javascript源码
2010-03-17 20:46:00
![](https://img.aspxhome.com/file/UploadPic/20103/17/2010317204821421s.jpg)
如何修复MySQL数据库表
2009-03-20 13:24:00
浅谈SQL Server中统计对于查询的影响分析
2012-06-06 20:08:23
重新发现HTML表格
2009-12-02 09:47:00
![](https://img.aspxhome.com/file/UploadPic/200912/2/01-38s.png)
python集合的创建、添加及删除操作示例
2022-07-09 13:29:38
用ASP显示ACCESS数据库的的GIF图象
2008-11-20 16:35:00
asp中常用的文件处理函数
2009-01-08 18:09:00
ASP XML操作类代码
2011-03-08 10:47:00
Python中函数的参数定义和可变参数用法实例分析
2023-10-04 00:26:30
Python变量和数据类型和数据类型的转换
2023-09-28 07:44:34
![](https://img.aspxhome.com/file/2023/5/87945_0s.png)
CSS写法性能
2009-05-28 19:09:00
![](https://img.aspxhome.com/file/UploadPic/20095/28/g2009521232840-47s.gif)
Windows8下安装Python的BeautifulSoup
2022-05-30 15:03:06
Django+Celery实现定时任务的示例
2023-07-27 19:48:18
![](https://img.aspxhome.com/file/2023/4/61704_0s.png)
正确理解SQL Server四类数据仓库建模方法
2008-12-23 15:20:00
利用Python实现简单的相似图片搜索的教程
2023-10-24 18:45:36
![](https://img.aspxhome.com/file/2023/6/79466_0s.jpg)
用YSlow评分插件分析我们页面
2008-08-26 11:48:00
Django 中间键和上下文处理器的使用
2022-04-19 05:04:56
![](https://img.aspxhome.com/file/2023/7/83667_0s.png)