938

5 分钟

#Python 的内置函数 tuple

说明:类型转换为 tuple

#函数说明

class tuple(): ''' 创建一个空元组 :return: 空元组 '''

说明

创建一个空元组

参数

返回值

空元组


class tuple(iterable): ''' 类型转换为 tuple :param iterable: 一个可迭代对象 :return: 转换为 tuple 后的值 '''

说明

将变量转换为 tuple 类型

参数

  • iterable - 要转换的可迭代对象

返回值

转换为 tuple 后的元组

#示例

print(tuple([1, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6]))

>>> Establishing WebAssembly Runtime.

>>> Standby.

Powered by Shift.

#推荐阅读

创建于 2025/6/9

更新于 2025/6/10