Python Language Copying data Performing a shallow copy of a list

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9


You can create shallow copies of lists using slices.

>>> l1 = [1,2,3]
>>> l2 = l1[:]     # Perform the shallow copy.
>>> l2
>>> l1 is l2

Got any Python Language Question?