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
URL 编码/解码
URL 编码/解码
Markdown 在线编辑器
Markdown 在线编辑器