python字典遍历
2016-12-16 13:28
155 查看
python字典遍历
1.a = {'a':1, 'b':2} for key in a.keys(): print key, print a[key] #输出 #a 1 #b 2
2.
a = {'a':1, 'b':2} for val in a.values(): print val #输出 #1 #2
3.
a = {'a':1, 'b':2} for key,value in a.items(): print key,value #输出 #a 1 #b 2
相关文章推荐
- python对字典的遍历
- 遍历python字典几种方法
- python 遍历字典
- python 字典(dict)遍历的四种方法性能测试报告
- 遍历python字典几种方法
- python 循环遍历字典元素
- python内置映射类型(mapping type):dict哈希字典遍历方式及其它用法举例
- python中遍历出所有字典数据
- Python字典的一些遍历
- Python学习-字典遍历
- 一段关于Python字典遍历的“争论”
- 一段关于Python字典遍历的“争论”
- 遍历python字典的几种方法
- 006_004 Python 链式遍历字典
- Python 字典结构遍历
- Python多维/嵌套字典数据无限遍历
- Python多维/嵌套字典数据无限遍历
- 遍历python字典几种方法
- Python中如何遍历字典
- python 循环遍历字典元素