tuple 可更改的列表和不可更改的元组
Posted 夜歌乘年少
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tuple 可更改的列表和不可更改的元组相关的知识,希望对你有一定的参考价值。
tuple
([iterable])
Return a tuple whose items are the same and in the same order as iterable‘s items. iterable may be a sequence, a container that supports iteration, or an iterator object. If iterable is already a tuple, it is returned unchanged. For instance, tuple(‘abc‘)
returns (‘a‘, ‘b‘, ‘c‘)
and tuple([1, 2, 3])
returns (1, 2, 3)
. If no argument is given, returns a new empty tuple, ()
.
tuple
is an immutable sequence type, as documented in Sequence Types — str, unicode, list, tuple, bytearray, buffer, xrange. For other containers see the built in dict
, list
, and set
classes, and the collections
module.
以上是关于tuple 可更改的列表和不可更改的元组的主要内容,如果未能解决你的问题,请参考以下文章