<languages />
要创建仅包含一个项目的元组,您必须在该项目后添加一个逗号,除非Python无法将变量识别为元组。
一个元组,记住逗号:
thistuple = ("apple",) print(type(thistuple)) #NOT a tuple thistuple = ("apple") print(type(thistuple))
Python元组教程
元组
访问元组项目
更改元组项目
循环清单项目
检查元组项是否存在
元组长度
删除元组项目
连接两个元组