Javatpoint Logo
Javatpoint Logo

Python List copy() Method

Python copy() method copies the list and returns the copied list. It does not take any parameter and returns a list. The method signature and examples are given below.

Signature

Parameters

No parameter

Return

It returns a copy of the list.

Let's see some examples of copy() method to understand it's functionality.

Python List copy() Method Example 1

A Simple example which copy a list ot another and makes an new list. See the example below.

Output:

Original list: [6, 8, 2, 4]
Copy list: [6, 8, 2, 4]

Python List copy() Method Example 2

Here, we are using list slicing concept to create a copy of the list. See the example below.

Output:

Original list: [6, 8, 2, 4]
Copy list: [6, 8, 2, 4]

Python List copy() Method Example 3

The assignment operator can also be used to copy a list into another. This is most general approach but not recommended.

Output:

Original list: [6, 8, 2, 4]
Copy list: [6, 8, 2, 4]

Next TopicPython Lists





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA