You can't remove elements from a tuple . Lists are a like tuples but are mutable. Like strings, lists can be indexed and sliced. There's one more kind of data structure: tuples .
Tuples can be converted into lists, and vice-versa.There is also another standard sequence data type: the tuple . 当分割一个tuple 时,会得到一个新的tuple 。 When you slice a tuple , you get a new tuple . 这样就会保留所有“y”域的值小于10的tuple 。 This will keep all tuples whose"y" field is less than 10. 有三种基本序列类型:list,tuple 和range对象。 There are three basic sequence types: lists, tuples , and range objects. PythonTutorial展示了如何定义一个只包含一个元素的tuple 。 Python Tutorial shows how to define a tuple with one element. 由于tuple 是构造器的名称,应避免将其用作变量名。 Because tuple is the name of a constructor, you should avoid using it as a variable name. 还介绍并使用了Pythontuple 类,以演示容器类型的概念。 The Python tuple class is also introduced and used to demonstrate the concept of a container type. 因为tuple 是内建函数名,所以应该避免将它用作变量名。 Because tuple is the name of a built-in function, you should avoid using it as a variable name. V是一个三元素的tuple ,并且(x,y,z)是一个三变量的tuple 。 V is a tuple of three elements, and(x, y, z) is a tuple of three variables. 它们是sequence数据类型的两个示例(参见序列类型-list,tuple ,range)。 They are two examples of sequence data types(see Sequence Types- list, tuple , range). 其他容器类型,请参见内置的list、set和tuple 类,以及collections模块。 For other containers see the built-in list, set, and tuple classes, and the collections module. 它们是序列数据类型的两个例子(参见SequenceTypes-list,tuple ,range)。 They are two examples of sequence data types(see Sequence Types- list, tuple , range). Python的for循环不仅可以用在list或tuple 上,还可以作用在其他可迭代对象上。 For' loop in python can be used not only on Lists and Tuples , but alse on any other iterable objects. 以下是2个序列数据类型的例子(具体请看SequenceTypes-list,tuple ,range)。 They are two examples of sequence data types(see Sequence Types- list, tuple , range). 关于其他容器对象请参看dict,list与tuple 等内置类,以及collections模块。 (For other containers see the built in dict, list, set, and tuple classes, and the collections module.). 您也可以使用多变量赋值来创建返回多个值的函数,只要返回一个包含所有值的tuple 即可。 You can also use multi-variable assignment to build functions that return multiple values, simply by returning a tuple of all the values. 如果该序列(sequence)是一个str,unicode或者tuple ,返回值必定是同一类型,否则,它总是list。 If sequence is a str, unicode or tuple , the result will be of the same type; otherwise, it is always a list. 这是一个“组合聚合器”,它知道怎样在向网络中发送tuple 之前以最好的效率进行部分聚合操作。 This is a"combiner aggregator", which knows how to do partial aggregations before transferring tuples over the network to maximize efficiency. HowtoThinkLikeaComputerScientist讲解了tuple 并且展示了如何连接tuple 。 How to Think Like a Computer Scientist teaches about tuples and shows how to concatenate tuples . 它们是序列数据类型的两个例子(参见序列类型-str,unicode,list,tuple ,bytearray,buffer,xrange。 They are two examples of sequence data types(see Sequence Types- str, unicode, list, tuple , bytearray, buffer, xrange). 在Python中,字符串,整形,浮点型,tuple 是不可更改的对象,而list,dict等是可以更改的对象。 In Python, strings, tuples , and numbers are unchangeable objects, while list, dict, etc. are objects that can be modified. 现在,让我们继续这两种数据类型并跳过List,Tuple 和Dictionary,它们是Python中的高级数据类型。 For now, let's proceed with these two data types and skip List, Tuple , and Dictionary, which are advanced data types in Python. Struct序列暴露了一个类似于namedtuple 的接口,因为元素可以通过索引或作为属性来访问。 Struct sequences expose an interface similar to named tuple in that elements can either be accessed either by index or as an attribute.
Display more examples
Results: 29 ,
Time: 0.0193