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]

Leave a Comment