YouTip LogoYouTip

Ref Set Copy

Python Set copy() Method |

Description

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

Syntax

Syntax for the copy() method:

set.copy()

Parameters

  • None.

Return Value

Returns a copy of the set.

Example

Copy the fruits set:

Example 1

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

Output:

set(['Google', 'Taobao', ''])
← Ref Set IntersectionMysql Functions β†’