Python3 字典 items() 方法

Python 3 教程 · 2019-02-06 16:14:15

描述

Python 字典 items() 方法以列表返回可遍历的(键, 值) 元组数组。

语法

items()方法语法:

dict.items()

参数

  • NA。

返回值

返回可遍历的(键, 值) 元组数组。

实例

以下实例展示了 items() 方法的使用方法:

#!/usr/bin/python3

dict = {'Name': 'Codercto', 'Age': 7}

print ("Value : %s" %  dict.items())

以上实例输出结果为:

Value : dict_items([('Age', 7), ('Name', 'Codercto')])

点击查看所有 Python 3 教程 文章: https://www.codercto.com/courses/l/10.html

查看所有标签

Pro JavaScript Design Patterns

Pro JavaScript Design Patterns

Dustin Diaz、Ross Harmes / Apress / 2007-12-16 / USD 44.99

As a web developer, you’ll already know that JavaScript™ is a powerful language, allowing you to add an impressive array of dynamic functionality to otherwise static web sites. But there is more power......一起来看看 《Pro JavaScript Design Patterns》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

随机密码生成器
随机密码生成器

多种字符组合密码

html转js在线工具
html转js在线工具

html转js在线工具