How to make a copy of a 2D array in Python? [duplicate]
Using deepcopy() or copy() is a good solution.For a simple 2D-array case
y = [row[:] for row in x]
For 2D arrays it's possible use map function:
old_array = [[2, 3], [4, 5]]# python2.*new_array = map(list, old_array)# python3.*new_array = list(map(list, old_array))