Python 集合 copy() 方法

實例

復制 fruits 集合:

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

運行實例

定義和用法

copy() 方法復制集合。

語法

set.copy()

參數值

無參數。