How to deep copy a list?

E0_copy is not a deep copy. You don’t make a deep copy using list(). (Both list(…) and testList[:] are shallow copies.) You use copy.deepcopy(…) for deep copying a list. See the following snippet – Now see the deepcopy operation