AlphaCodingSkills

Python - List copy() Method


Advertisements

The Python list copy() method is used to copy the entire list into a new list.

Syntax


list.copy()

Parameters

No parameter is required.

Example:

In the below example, list copy() method is used to copy the list called MyList into the list called NewList.

MyList = ['Red', 'Blue', 'Green']
NewList = MyList.copy()
print(NewList)

Output

['Red', 'Blue', 'Green'] 

Lists Methods