Answers for "copy a list python"

1

copy one list to another python

thislist = ["apple", "banana", "cherry"]
mylist = thislist.copy()
print(mylist)
Posted by: Guest on May-17-2020
0

how to copy list python

new_list = old_list.copy()
# Above new_list does not get affected when modifying old_list
new_list = old_list
#Here new_list is also affected if any modifications are made to old_list
Posted by: Guest on June-09-2021
0

python copy list

a=[1,2,3,4]
b=a[:] 
''' now b has all elements of  a'''
Posted by: Guest on September-29-2020

Python Answers by Framework

Browse Popular Code Answers by Language