Python 3 教程教程
Python3 tuple 函数
Python3 tuple 函数
Python3 tuple 函数
Python3 内置函数描述
tuple 函数将可迭代系列(如列表)转换为元组。
语法
以下是 tuple 的语法:
tuple( iterable )
参数
- iterable -- 要转换为元组的可迭代序列。
返回值
返回元组。
实例
以下展示了使用 tuple 的实例:
实例
>>>list1= ['Google', 'Taobao', 'verydoc', 'Baidu']
>>> tuple1=tuple(list1)
>>> tuple1
('Google', 'Taobao', 'verydoc', 'Baidu')
Python3 tuple 函数 |
---|
Python 3 教程
Python的3.0版本,常被称为Python 3000,或简称Py3k。相对于Python的早期版本,这是一个较大的升级。为了不带入过多的累赘,Python 3.0在设计的时候没有考虑向下兼容。