内容简介:Python 字典(Dictionary) clear() 函数用于删除字典内所有元素。
描述
Python 字典(Dictionary) clear() 函数用于删除字典内所有元素。
语法
clear()方法语法:
dict.clear()
参数
- NA。
返回值
该函数没有任何返回值。
实例
以下实例展示了 clear()函数的使用方法:
#!/usr/bin/python dict = {'Name': 'Zara', 'Age': 7}; print "Start Len : %d" % len(dict) dict.clear() print "End Len : %d" % len(dict)
以上实例输出结果为:
Start Len : 2 End Len : 0
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- 【Python—字典的用法】创建字典的3种方法
- Python 字典(Dictionary) cmp()方法
- Python 字典(Dictionary) len()方法
- Python 字典(Dictionary) str()方法
- Python 字典(Dictionary) type()方法
- Python 字典(Dictionary) copy()方法
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Unreal Engine 4 Scripting with C++ Cookbook
Sherif, William、Stephen Whittle / 2016-10-24
Unreal Engine 4 (UE4) is a complete suite of game development tools made by game developers, for game developers. With more than 100 practical recipes, this book is a guide showcasing techniques to us......一起来看看 《Unreal Engine 4 Scripting with C++ Cookbook》 这本书的介绍吧!