元组操作

元祖的修改:

元祖的元素不可修改

a = (1,2,3,4)
del a[0]
>>>Traceback (most recent call last):
 File "<pyshell#38>", line 1, in <module>
 del a[0]
 TypeError: 'tuple' object doesn't support item deletion

元祖的元素的元素可以修改

a = (1,2,3,{'a':'b'})
(a[3]['a'] = 'c')
print (a)
>>>(1,2,3,{'a':'c'})

  

posted @ 2017-11-14 11:48  jacky_zhao  阅读(98)  评论(0编辑  收藏  举报