simple Python question:
Example list: A = [1,2,3,4,5]
I need to generate another list B which is a shallow copy of list A such that B is a new list containing the same elements in the same order (so that I can substitute one of B's elements w/o affecting A). How can I do this?
clarification: I want to do something like
def some_func(A)
B = {what do I do here to get a copy of A's elements?}
B[0] = some_other_func(B[0])
yet_another_func(B)
based on all your answers + the Python docs, a better way to do what I want is the following:
def some_func(A)
B = [some_other_func(A[0])] + A[1:]
yet_another_func(B)
thanks for pointing me in the right direction!