Python 官方文档:入门教程 => 点击学习
在python中使用tuple()函数将列表转换为元组的方法tuple:tuple()函数的作用是将列表转换为元组。tuple()函数语法:tuple( iterable )参数:iterable:表示需要转换为元组的可迭代序列。tuple
在python中使用tuple()函数将列表转换为元组的方法
tuple:tuple()函数的作用是将列表转换为元组。
tuple()函数语法:
tuple( iterable )
参数:
iterable:表示需要转换为元组的可迭代序列。
tuple()函数使用方法:
List = [123, 'xyz', 'zara', 'abc'];
aTuple = tuple(List)
print "Tuple elements : ", aTuple
输出结果为:
Tuple elements : (123, 'xyz', 'zara', 'abc')
--结束END--
本文标题: python使用tuple函数将列表转换为元组
本文链接: https://www.lsjlt.com/news/112755.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0