Python简单定义与使用字典dict的方法示例
作者:坏蛋是我 时间:2023-03-10 03:22:48
本文实例讲述了Python简单定义与使用字典的方法。分享给大家供大家参考,具体如下:
#coding=utf8
print '''''
Python中的字典映射数据类型是由键值对构成。
python中字典一般以数字或者字符串作为键。
Python中字典的值可以是任意类型的Python对象,字典元素用大括号{}包裹。
'''
dicDefine={
'Name':'ewang',
'Age': 28,
'Sex': 'famale',
'BirthDay':'1998/09/1'
}
print 'The content of dicDefind',dicDefine
print 'The keys of dicDefind',dicDefine.keys( )
print 'The values of dicDefind',dicDefine.values()
print 'The items of dicDefind',dicDefine.items()
运行结果:
希望本文所述对大家Python程序设计有所帮助。
标签:Python,字典
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
浅谈web分析
2008-12-02 15:52:00
![](https://img.aspxhome.com/file/UploadPic/200812/2/03-35.jpg)
MySQL prepare语句的SQL语法
2024-01-20 03:14:08
利用d3.js实现蜂巢图表带动画效果
2024-04-18 10:15:19
![](https://img.aspxhome.com/file/2023/7/136097_0s.gif)
php通过exif_read_data函数获取图片的exif信息
2023-10-27 09:01:44
MSSQL存储过程学习笔记一 关于存储过程
2024-01-17 18:59:43
防止删库跑路及高级代码投毒技巧
2022-03-27 13:20:16
![](https://img.aspxhome.com/file/2023/0/123740_0s.png)
浅析Python中的多重继承
2021-03-19 21:17:56
![](https://img.aspxhome.com/file/2023/0/127080_0s.png)
asp中Adodb.Stream 的使用说明
2007-09-11 13:53:00
60个vue常用工具类
2024-06-07 16:03:50
Python OpenCV实现图片上输出中文
2021-07-01 15:00:11
![](https://img.aspxhome.com/file/2023/3/115003_0s.jpg)
centos 6.9安装mysql的详细教程
2024-01-13 06:51:15
Go语言实现的web爬虫实例
2023-07-21 02:35:57
Python读取Excel数据实现批量生成合同
2022-08-15 02:12:12
![](https://img.aspxhome.com/file/2023/4/115714_0s.jpg)
MySQL时间字段究竟使用INT还是DateTime
2010-03-09 14:46:00
JSP 获取spring容器中bean的两种方法总结
2023-06-15 07:27:46
Python文件操作及内置函数flush原理解析
2021-07-16 06:43:38
![](https://img.aspxhome.com/file/2023/6/109406_0s.png)
python执行get提交的方法
2022-08-09 01:53:12
Python Spyder 调出缩进对齐线的操作
2023-07-17 00:56:04
![](https://img.aspxhome.com/file/2023/2/61172_0s.jpg)
Python操作PDF实现制作数据报告
2022-05-09 21:41:51
![](https://img.aspxhome.com/file/2023/9/121069_0s.png)
Mysql主从复制注意事项的讲解
2024-01-28 10:57:32