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://www.codercto.com/courses/l/10.html
The Cult of the Amateur
Andrew Keen / Crown Business / 2007-6-5 / USD 22.95
Amateur hour has arrived, and the audience is running the show In a hard-hitting and provocative polemic, Silicon Valley insider and pundit Andrew Keen exposes the grave consequences of today’s......一起来看看 《The Cult of the Amateur》 这本书的介绍吧!