how to copy new object insted of ponting at object python

Solutions on MaxInterview for how to copy new object insted of ponting at object python by the best coders in the world

showing results for - "how to copy new object insted of ponting at object python"
David
17 Nov 2017
1>>> import copy
2>>> xs = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
3>>> zs = copy.deepcopy(xs)
4>>> xs[1][0] = 'X'
5>>> xs
6[[1, 2, 3], ['X', 5, 6], [7, 8, 9]]
7>>> zs
8[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
similar questions