chevron_left
Set Operations
0
0
0
new
Python Set | copy method
Programming
chevron_rightPython
chevron_rightOperations
chevron_rightSet Operations
schedule Mar 10, 2022
Last updated Python
Tags tocTable of Contents
expand_more Python's set.copy()
method returns a copy of the specified set.
Parameters
The set.copy()
method does not take any parameters.
Return value
Returns a copy of the original set. Note the original set is not modified.
Examples
Basic usage
car = {"Toyota", "Nissan", "Honda"}new_car = car.copy()
print(car)print(new_car)
{'Nissan', 'Toyota', 'Honda'}{'Nissan', 'Toyota', 'Honda'}
Published by Isshin Inada
Edited by 0 others
Did you find this page useful?
Ask a question or leave a feedback...
Official Python Documentation
https://docs.python.org/3/library/stdtypes.html#frozenset.copy