Deep copy Python with integers vs arrays

前端 未结 0 1448
半阙折子戏
半阙折子戏 2021-01-26 03:26

Given the following code:

x = y = z = 0
x = 10
print(y) // prints 0

x = y = z = [1, 2, 3, 4, 5]
x[0] = 10
print(y) // prints [10, 2, 3, 4, 5]

Ho

相关标签:
回答
  • 消灭零回复
提交回复
热议问题