Python3 字典 clear()方法
Python 3 教程
· 2019-02-06 14:58:01
描述
Python 字典 clear() 函数用于删除字典内所有元素。
语法
clear()方法语法:
dict.clear()
参数
- NA。
返回值
该函数没有任何返回值。
实例
以下实例展示了 clear()函数的使用方法:
#!/usr/bin/python3
dict = {'Name': 'Zara', 'Age': 7}
print ("字典长度 : %d" % len(dict))
dict.clear()
print ("字典删除后长度 : %d" % len(dict))
以上实例输出结果为:
字典长度 : 2 字典删除后长度 : 0
点击查看所有 Python 3 教程 文章: https://codercto.com/courses/l/10.html
Machine Learning in Action
Peter Harrington / Manning Publications / 2012-4-19 / GBP 29.99
It's been said that data is the new "dirt"—the raw material from which and on which you build the structures of the modern world. And like dirt, data can seem like a limitless, undifferentiated mass. ......一起来看看 《Machine Learning in Action》 这本书的介绍吧!