Python3 tuple 函数

Python3 内置函数 Python3 内置函数


描述

tuple 函数将可迭代系列(如列表)转换为元组。

语法

以下是 tuple 的语法:

tuple( iterable )

参数

  • iterable -- 要转换为元组的可迭代序列。

返回值

返回元组。


实例

以下展示了使用 tuple 的实例:

实例

>>>list1= ['Google', 'Taobao', 'iCodebang', 'Baidu']
>>> tuple1=tuple(list1)
>>> tuple1
('Google', 'Taobao', 'iCodebang', 'Baidu')

Python3 内置函数 Python3 内置函数

0 个评论

要回复文章请先登录注册