内容简介:Python 字典(Dictionary) items() 函数以列表返回可遍历的(键, 值) 元组数组。
描述
Python 字典(Dictionary) items() 函数以列表返回可遍历的(键, 值) 元组数组。
语法
items()方法语法:
dict.items()
参数
- NA。
返回值
返回可遍历的(键, 值) 元组数组。
实例
以下实例展示了 items()函数的使用方法:
#!/usr/bin/python dict = {'Name': 'Zara', 'Age': 7} print "Value : %s" % dict.items()
以上实例输出结果为:
Value : [('Age', 7), ('Name', 'Zara')]
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- 【Python—字典的用法】创建字典的3种方法
- Python 字典(Dictionary) cmp()方法
- Python 字典(Dictionary) len()方法
- Python 字典(Dictionary) str()方法
- Python 字典(Dictionary) type()方法
- Python 字典(Dictionary) clear()方法
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Code Reading
Diomidis Spinellis / Addison-Wesley Professional / 2003-06-06 / USD 64.99
This book is a unique and essential reference that focuses upon the reading and comprehension of existing software code. While code reading is an important task faced by the vast majority of students,......一起来看看 《Code Reading》 这本书的介绍吧!