小白教程
所有教程
关于
Search
172.69.7.125
172.69.7.125
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Ref set pop”的源代码
本页内容
上一节:
Ref_set_issuperset
下一节:
Ref_set_remove
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:pop()}}[[Category:python3 set|12]] = Python Set pop() 方法 = [[python3 set#setmethod|Python 集合]] == 描述 == pop() 方法用于随机移除一个元素。 == 语法 == pop() 方法语法: <sample title="" desc="" lang="python" hererun="1"> set.pop() </sample> == 参数 == * 无 == 返回值 == 返回移除的元素。 随机移除一个元素: == 实例 1 == <sample title="" desc="" lang="python" hererun="1"> fruits = {"apple", "banana", "cherry"} fruits.pop() print(fruits) </sample> 输出结果为: <sample title="" desc="" lang="python" hererun="1"> {'apple', 'banana'} </sample> 输出返回值: == 实例 1 == <sample title="" desc="" lang="python" hererun="1"> fruits = {"apple", "banana", "cherry"} x = fruits.pop() print(x) </sample> 输出结果为: <sample title="" desc="" lang="python" hererun="1"> banana </sample> [[python3 set#setmethod|Python 集合]]
返回至“
Ref set pop
”。
上一节:
Ref_set_issuperset
下一节:
Ref_set_remove