python 数据类型 之元组
# tp1 = (1, 2, 3) # tp1 = (1,) tp1 = 1, 2, 3 tp2 = (4, 5, 6) # 可以直接拼接在一起 # tp3 = tp1 + tp2 # print(tp3, type(tp3)) # 重复指定次数 tp4 = tp1 * 3 print(tp4) # 统计元素个数 print(len(tp4)) tp = (1, 2, 3, 4, 5, 6) # 切片操作 print(tp[0], tp[-1]) print(tp[1:-1]) # 获取指定元素的索引 print(tp.index(3)) # 统计元素出现的次数 print(tp.count(3)) # 最大值 print(max(tp)) # 最小值 print(min(tp))