method copy list python code example
Example 1: copy a list python
new_list = old_list.copy()
# or
new_list = old_list[:]
Example 2: python copy list
a=[1,2,3,4]
b=a[:]
''' now b has all elements of a'''
new_list = old_list.copy()
# or
new_list = old_list[:]
a=[1,2,3,4]
b=a[:]
''' now b has all elements of a'''