tuple 创建元组

内置函数(类)tuple,Python 官方文档描述如下:

help(tuple)
Help on class tuple in module builtins:

class tuple(object)
 |  tuple(iterable=(), /)
 |  
 |  Built-in immutable sequence.
 |  
 |  If no argument is given, the constructor returns an empty tuple.
 |  If iterable is specified the tuple is initialized from iterable's items.
 |  
 |  If the argument is a tuple, the return value is the same object.
 |  

将可迭代对象转换为元组。可迭代对象为空或不传参数,返回空元组。

type(tuple)
type
tuple('')
()
tuple('123')
('1', '2', '3')