Answers for "how to copy new object insted of ponting at object python"

0

how to copy new object insted of ponting at object python

>>> import copy
>>> xs = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
>>> zs = copy.deepcopy(xs)
>>> xs[1][0] = 'X'
>>> xs
[[1, 2, 3], ['X', 5, 6], [7, 8, 9]]
>>> zs
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
Posted by: Guest on March-23-2021

Code answers related to "how to copy new object insted of ponting at object python"

Python Answers by Framework

Browse Popular Code Answers by Language