Python Set copy() Method

Python3 列表Python Sets


Description

The copy() method is used to copy a set.

Syntax

The syntax of the copy() method is:

set.copy()

Parameters

  • None.

Return Value

Returns the copied set.

Examples

Copy the fruits set:

Example 1

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

The output result is:

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

Python3 列表Python Sets

Other Extensions