#create a tuple tuplex = "w", "j" ,"c", "e" print(tuplex) #tuples are immutable, so you can not remove elements #using merge of tuples with the + operator you can remove an item and it will create a new tuple tuplex
python中列表(list)和元组(tuple)有很多相似的地方,它们都是容器,由一系列的对象构成,都可以包含任意类型的元素,甚至是一个序列. list和tuple的不同首先体现在写法上: list由方括号引导: L = [ele1,ele2,ele3] tuple由圆括号引导: T = (ele1,ele2,ele3) 字典由大括号引导: D = {key1:val1,key2:val2,key3:val3} 列表和元组根本的区别是列表是可变的,而元组是不可变的,任何试图修改一个已经定义