The collection of objects can be any Python container type, including the tuple, string, and list types discussed in earlier articles.
对象集合可以是任何Python容器类型,包括前面文章中讨论的tuple、string和list类型。
You can use the for loop with any Python object that provides an iterator, including the built-in sequence types such as the tuple, string, and list.
可以将for循环与提供迭代器的任何Python对象结合使用,这些对象包括tuple、string和list等内置序列类型。
The rest of this article discusses the tuple type, which serves to introduce many of the fundamental concepts related to creating and using container types in Python.
本文的其余部分讨论了tuple类型,它用于引入许多与创建和使用Python中的容器类型有关的基本概念。
In Listing 2, you can see that each element in a tuple can be of a different type, but the types in a list must be homogeneous.
在清单2中,可以看到tuple中的每个元素可以是不同类型的,但列表中的元素必须是相同类型的。
There are current three types of tuple.
目前有三种类型的tuple。
The Python tuple type behaves in a similar manner as a bag in that it can hold different types of objects.
Python的tuple类型与口袋类似,它可以存放不同类型的对象。
And just like a tuple, a list can hold different types of data (or different types of objects). This is what I mean by a heterogeneous mutable sequence.
就像tuple一样,list也可以持有不同类型的数据(或不同类型的对象),这就是我所说的异构的可变序列。
Previous articles in this series introduced some of the container data types in the Python programming language, including the tuple, the string, and the list (see Resources).
本系列中前面的文章介绍了Python编程语言中的一些容器数据类型,包括tuple、string和list(参见参考资料)。
Most of the container types in Python, including the tuple, allow you to access items easily from the collection using the square bracket operators.
Python中的多数容器类型(其中包括tuple)允许您使用方括号操作符从集合中方便地访问数据项。
This basically means that a tuple can hold different types of objects, but once it's created, it can't be changed.
这主要是说tuple可以存放不同类型的对象,但是它一旦创建,就无法更改。
If values are present, each value can either be a single value of a specified type, or a tuple that aggregates multiple values of the same or different types.
如果值存在,则每个值既可以是指定类型的单个值,也可以是聚合相同类型或不同类型的多个值的元组。
If values are present, each value can either be a single value of a specified type, or a tuple that aggregates multiple values of the same or different types.
如果值存在,则每个值既可以是指定类型的单个值,也可以是聚合相同类型或不同类型的多个值的元组。
应用推荐