Python Set clear()方法

Python 3 教程 · 2019-02-06 18:12:05

描述

clear() 方法用于移除集合中的所有元素。

语法

clear()方法语法:

set.clear()

参数

  • 无。

返回值

无。

实例

移除 fruits 集合中的所有元素:

实例 1

fruits = {"apple", "banana", "cherry"} fruits.clear() print(fruits)

输出结果为:

set()

点击查看所有 Python 3 教程 文章: https://codercto.com/courses/l/10.html

查看所有标签

The Art and Science of Java

The Art and Science of Java

Eric Roberts / Addison-Wesley / 2007-3-1 / USD 121.60

In The Art and Science of Java, Stanford professor and well-known leader in CS Education Eric Roberts emphasizes the student-friendly exposition that led to the success of The Art and Science of C. By......一起来看看 《The Art and Science of Java》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具