Python 3 教程教程
Python3 字典 items() 方法
Python3 字典 items() 方法
Python3 字典 items() 方法
描述
Python 字典 items() 方法以列表返回可遍历的(键, 值) 元组数组。
语法
items()方法语法:
dict.items()
参数
- NA。
返回值
返回可遍历的(键, 值) 元组数组。
实例
以下实例展示了 items() 方法的使用方法:
实例
#!/usr/bin/python3
dict = {'Name': 'verydoc', 'Age': 7}
print ("Value : %s" % dict.items())
以上实例输出结果为:
Value : dict_items([('Age', 7), ('Name', 'verydoc')])
Python3 字典 items() 方法 |
---|
Python 3 教程
Python的3.0版本,常被称为Python 3000,或简称Py3k。相对于Python的早期版本,这是一个较大的升级。为了不带入过多的累赘,Python 3.0在设计的时候没有考虑向下兼容。