python多重赋值后没有改变列表中的各项表项

代码如下:

student = ['c', 'c', 'c']
a, b, c = student
print(student)

运行结果:
['c', 'c', 'c']

阅读 1.5k
1 个回答
>>> a, b, c =student

相当于:

>>> a, b, c = student[0], student[1], student[2]
>>> a
'c'
>>> b
'c'
>>> c
'c'

student 本身不会发生变化。

推荐问题