(python)每日代码||2024.1.18||元组中的列表成员可以改变内容,不可以改变该列表成员
t = ([1,2,3],[2,3,4],3)
print(t)
t[0][1]=9
print(t)
# ~ t[2]=9#TypeError: 'tuple' object does not support item assignment
# ~ print(t)
'''
([1, 2, 3], [2, 3, 4])
([1, 9, 3], [2, 3, 4])
'''
t = ([1,2,3],[2,3,4],3)
print(t)
t[0][1]=9
print(t)
# ~ t[2]=9#TypeError: 'tuple' object does not support item assignment
# ~ print(t)
'''
([1, 2, 3], [2, 3, 4])
([1, 9, 3], [2, 3, 4])
'''