Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from copy import deepcopy
- #1
- sth1 = [[1, 2, 3], [2, 3, 4]]
- sth2 = sth1[:]
- sth2[0] = [7, 8, 9]
- print(sth1)
- print(sth2)
- #2
- sth1 = [[1, 2, 3], [2, 3, 4]]
- sth2 = sth1[:]
- sth2[0][0] = 'something_deep'
- print(sth1)
- print(sth2)
- #3
- sth1 = [[1, 2, 3], [2, 3, 4]]
- sth2 = deepcopy(sth1)
- sth2[0][0] = 'something_deep'
- print(sth1)
- print(sth2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement