Copying nested lists in Python Copying nested lists in Python python python

Copying nested lists in Python


For a more general solution that works regardless of the number of dimensions, use copy.deepcopy():

import copyb = copy.deepcopy(a)