Python 字典 keys() 方法,,描述Python 字
Python 字典 keys() 方法,,描述Python 字
描述
Python 字典 keys() 方法以列表形式(并非直接的列表,若要返回列表值还需调用list函数)返回一个字典所有的键。
语法
keys()方法语法:
dict.keys()
参数
NA。返回值
以列表形式返回一个字典所有的键。
实例
以下实例展示了 keys() 方法的使用方法:
# !/usr/bin/python3dict = {‘Name‘: ‘Runoob‘, ‘Age‘: 7}print("字典所有的键为: %s" % dict.keys())print("转换为列表形式为:%s" % list(dict.keys()))
以上实例输出结果为:
字典所有的键为: dict_keys([‘Age‘, ‘Name‘])转换为列表形式为:[‘Age‘, ‘Name‘]
Python 字典 keys() 方法
相关内容
- python输入输出之用户名密码,,方法一: 1 # A
- python-opencv安装及入门,,零、安装Python
- python 创建游标,,import pym
- Python 日期和时间的几种输出格式,,在python中,我
- 万张PubFig人脸数据实现基于python+OpenCV的人脸特征定位程
- Python里list的那些method学习笔记,,__author__
- Python 瀛楀吀 copy()鏂规硶,,鏍囩锛?a hre
- python实现scp功能,,最近公司有一个需求,
- python3接口性能测试,,# coding=u
- Python中的int(x,base)函数,,ython中的int
评论关闭