Python 字典(Dictionary) keys()方法

Python 教程 · 2019-02-03 08:11:49

描述

Python 字典(Dictionary) keys() 函数以列表返回一个字典所有的键。

语法

keys()方法语法:

dict.keys()

参数

  • NA。

返回值

返回一个字典所有的键。

实例

以下实例展示了 keys()函数的使用方法:

#!/usr/bin/python

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

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

以上实例输出结果为:

Value : ['Age', 'Name']

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

查看所有标签

About Face 2.0

About Face 2.0

Alan Cooper、Robert M. Reimann / Wiley / March 17, 2003 / USD 35.00

First published seven years ago-just before the World Wide Web exploded into dominance in the software world-About Face rapidly became a bestseller. While the ideas and principles in the original book......一起来看看 《About Face 2.0》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

SHA 加密
SHA 加密

SHA 加密工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具