python中,tuple里的list中的元素为何能够变,tuple到底可不可变?

众所周知,tuple与list的区别就是tuple是不可变的,是为了让程序更安全,tuple能够看成dict的key可是list不行。但tuple并非彻底不可变的,以下所示,tuple中的list的元素就是能够修改的。python >>> a = 1 >>> b = 2 >>> c = [3,4,5] >>> d = (a,b,c) >>> d (1, 2, [3, 4, 5]) >>> d[2]
相关文章
相关标签/搜索