What is List Copy() Method?

The list Copy() function in Python is used to create a copy of a list. There are two main ways to create a copy of the list Shallow copy and Deep copy. We will discuss the list copy() method in detail below.

The list copy() function is used to create a copy of a list, which can be used to work and it will not affect the values in the original list. This gives freedom to manipulate data without worrying about data loss.

Python List copy() Method

The list Copy() method makes a new shallow copy of a list.

Example

Python3




# Using list fruits
fruits = ["mango","apple","strawberry"]
# creating a copy shakes
shakes = fruits.copy()
# printing shakes list
print(shakes)


Output

['mango', 'apple', 'strawberry']

Similar Reads

What is List Copy() Method?

...

List copy() Method Syntax

The list Copy() function in Python is used to create a copy of a list. There are two main ways to create a copy of the list Shallow copy and Deep copy. We will discuss the list copy() method in detail below....

How to Create a Simple Copy of a List in Python

list.copy()...

More Examples on List copy() Method

Copying and creating a new list can be done using copy() function in Python....

Shallow Copy and Deep Copy

...

Copy List Using Slicing

Let us see a few examples of the list copy() method....