Python list - copy method

The copy() method, copies a python list into a new list object and have the references to the original list of objects in the new list.

List Updated 11 Sep 2016 1 min read

Method Name

copy

Method Signature

copy()

Method Overview

  • The copy() method returns a shallow copy of the Python list object.
  • A new list is created and the references to the elements that are present in the orginal list are copied into the new list. Note that, the elements present in the original list are not cloned. Hence, this is a shallow copy.

Parameters

None

Return Type

None

Example

python
>>> objects=['Calculator','Integrated Chip','Logical Gate']

>>> objects_copy=objects.copy()

>>> print(objects_copy)

['Calculator', 'Integrated Chip', 'Logical Gate']