Python Set pop() 方法

Python 3 教程 · 2019-02-06 20:27:39

描述

pop() 方法用于随机移除一个元素。

语法

pop() 方法语法:

set.pop()

参数

返回值

返回移除的元素。

实例

随机移除一个元素:

实例 1

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

输出结果为:

{'apple', 'banana'}

输出返回值:

实例 1

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

输出结果为:

banana

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

查看所有标签

Algorithms of the Intelligent Web

Algorithms of the Intelligent Web

Haralambos Marmanis、Dmitry Babenko / Manning Publications / 2009-7-8 / GBP 28.99

Web 2.0 applications provide a rich user experience, but the parts you can't see are just as important-and impressive. They use powerful techniques to process information intelligently and offer featu......一起来看看 《Algorithms of the Intelligent Web》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具