Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python Set copy() Method

Python Set copy() Method

Python3 Lists Python Sets


Description

The copy() method copies a set.

Syntax

Syntax of the copy() method:


set.copy()

Parameters

Return Value

Returns the copied set.

Example

Copy the fruits set:

Example 1

sites

= {

"

Google

"

,

"

Runoob

"

,

"

Taobao

"

}

x

=

sites

.

copy

(

)

print

(

x

)

The output is:


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

Python3 Lists Python Sets