Discuss / Python / 数组,变量

数组,变量

Topic source

loveKD92

#1 Created at ... [Delete] [Delete and Lock User]

无论list还是tuple,均是表示指向,既是指向一个数组。

B=['w','e','r'] C=B C[0]='a' print(C) 则输出为 ['a','e','r'].因B,C均指向同一数组,所以输出相同。

数组与单个变量不同,a='asd';b=a;a='qwe', 则b为'asd',a为'qwe'.


  • 1

Reply