python 字典列表 列表字典
来源:互联网 发布:网络连接服务器 编辑:程序博客网 时间:2024/05/17 22:26
如何访问字典列表,列表字典中的元素?
字典列表:一个列表,其元素是字典
获取'65':列表settings中的字典{'default_value': '65', 'name': 'storage_group_near_full_threshold'}中的值>>> settings=[{'default_value': '65', 'name': 'storage_group_near_full_threshold'}, {'default_value': '85', 'name': 'storage_group_full_threshold'}, {'default_value': '75', 'name': 'ceph_near_full_threshold'}, {'default_value': '90', 'name': 'ceph_full_threshold'}, {'default_value': '100', 'name': 'pg_count_factor'}]
>>> for i in settings:
... if i['name']=='storage_group_near_full_threshold':
... print i['default_value']
...
65
列表字典:一个字典,其键值有列表
获取'65':字典settings中的列表['65', '85', '75', '90', '100']中的值>>> settings={'name': 'settings', 'third': [], 'second': ['65', '85', '75', '90', '100'], 'single': [], 'fourth': [], 'fifth': [], 'first': ['storage_group_near_full_threshold', 'storage_group_full_threshold', 'ceph_near_full_threshold', 'ceph_full_threshold', 'pg_count_factor']}
>>> print settings['first'].index('storage_group_near_full_threshold')
0
>>> index=settings['first'].index('storage_group_near_full_threshold')
>>> print settings['second'][index]
65
0 0
- python 字典列表 列表字典
- Python字典、列表排序
- python: 列表、字典
- python列表,字典
- Python +字符串+列表+字典
- python列表 数组 字典
- python列表VS字典
- Python列表数组字典
- python 列表转字典
- python 列表字符串字典
- Python列表,集合,字典
- python字典列表实例
- python 列表、字典、集合
- python 字典套字典或列表
- 列表,字典
- PYTHON循环(列表,字典)
- Python:元组、列表、字典
- python:列表和字典型
- 【hadoop】 1001-hadoop介绍
- 数据结构 第一章 思维导图
- SQLite:关于日期的字段的优化将给Julia带来大幅效率提升
- 江苏科技大学2014-2015年物流管理考试重点
- ShareedPreferences存储
- python 字典列表 列表字典
- 状态模式案例学习
- Android在一个应用中调用另一个应用
- 第七章 知识导图
- 写文章时输出特殊形式小结
- zk 学习笔记
- 无限级别联动,怎样才能做活?
- 使用git应用补丁文件
- 加速计:CMMotionManager的pull , 直接开始采样