定義初始化元組
tuple1 = (1,2,3,4,5,6,7,8)
獲取元組中的數據
tuple1[1] 獲取第二個元素
tuple1[5:] 從第六個元素開始取到結束
tuple2 = tuple1[:]
元組中只有一個元素:tuple3 = (1,)
str方法
tuple1 = (1,2,3,4,5,6,7,8)
tuple1[1] 獲取第二個元素
tuple1[5:] 從第六個元素開始取到結束
tuple2 = tuple1[:]
元組中只有一個元素:tuple3 = (1,)