Python语言基础
Python语言进阶
Python数据结构

Python dictionary items() 方法

搞懂Python dictionary items() 方法的用法

描述

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

语法

items()方法语法:
dict.items()

参数

NA。

返回值

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

实例

以下实例展示了 items() 方法的使用方法:
dict = {'Name' : 'Lidihuo' , 'Age' : 2}
print( "Value : %s " % dict.items ())
以上实例输出结果为:
Value : dict_items([('Name', 'Lidihuo'), ('Age', 2)])
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4