1.3 元组(待编辑)
2、不可变对象,不可以修改元素
元组中有子列表,子列表的值可以修改
3、只有一个值时加,tuple2 = (10,)
tuple2 = (10,) tuple3 = (100,200,300,[400,500]) # 1类型 print(type(tuple2)) # 1 切片 print(tuple3[0:2]) # 子列表值可以修改 tuple3[3][0] = 409 print(tuple3)
如果元组中有子列表,子列表中的值能否修改
可以修改
只认直接领导
tuple2 = (1,2,[3,4,5])
tuple2[2]是列表
tuple2[2].pop()
tuple22=4