Python 3 教程 Python Set copy()方法

twoee · 2022-03-14 15:03:27 · 热度: 8

描述

copy() 方法用于拷贝一个集合。

语法

copy() 方法语法:

set.copy()

参数

  • 无。

返回值

返回拷贝的集合。

实例

拷贝 fruits 集合:

实例 1

sites = {"Google", "Codercto", "Taobao"} x = sites.copy() print(x)

输出结果为:

set(['Google', 'Taobao', 'Codercto'])

查看更多 Python 集合 内置函数

猜你喜欢:
暂无回复。
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册