Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 724 Bytes

7. Python 字典Dictionary keys方法.md

File metadata and controls

33 lines (23 loc) · 724 Bytes

Python 字典(Dictionary) keys()方法

描述

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

语法

        keys()方法语法:

dict.keys()

参数

  • NA。

返回值

        返回一个字典所有的键。

实例

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

#!/usr/bin/python

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

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

        以上实例输出结果为:

Value : ['Age', 'Name']