Python3 字典 values() 方法
Python 3 教程
· 2019-02-06 17:11:55
描述
Python 字典 values() 方法返回一个迭代器,可以使用 list() 来转换为列表,列表为字典中的所有值。
语法
values()方法语法:
dict.values()
参数
- NA。
返回值
返回迭代器。
实例
以下实例展示了 values() 方法的使用方法:
#!/usr/bin/python3
dict = {'Sex': 'female', 'Age': 7, 'Name': 'Zara'}
print ("字典所有值为 : ", list(dict.values()))
以上实例输出结果为:
字典所有值为 : ['female', 'Zara', 7]
点击查看所有 Python 3 教程 文章: https://codercto.com/courses/l/10.html
Out of their Minds
Dennis Shasha、Cathy Lazere / Springer / 1998-07-02 / USD 16.00
This best-selling book is now available in an inexpensive softcover format. Imagine living during the Renaissance and being able to interview that eras greatest scientists about their inspirations, di......一起来看看 《Out of their Minds》 这本书的介绍吧!