Python语言基础1.6

101 阅读1分钟

元组(tuple):不可更改序列

1.1)定义元组,如:

thistuple = ("apple""banana""cherry")

1.2)遍历元组并返回元组值与对应的下标,如:

for index,value in enumerate(thetuple):
   print("index:",index"value:",value)