Python Set copy() Method

❮ Set Methods


Example

Copy the fruits set:

fruits = {"apple", "banana", "cherry"}

x = fruits.copy()

print(x)
Try it Yourself »

Definition and Usage

The copy() method copies the set.


Syntax

set.copy()

Parameter Values

No parameters


❮ Set Methods

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.