本页内容
上一节: Python_func_print 下一节: Python_func_callable

Python3 tuple 函数

Python3 内置函数

描述

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

语法

以下是 tuple 的语法:


示例

tuple( iterable )

参数

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

返回值

返回元组。

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


示例

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

Python3 内置函数

上一节: Python_func_print 下一节: Python_func_callable
此页面最后编辑于2022年8月17日 (星期三) 21:49。