这样可以吗:
t = ('blue', 'yellow', 'red', 'white', 'black') print(t[0:3]) # 获取前三 print(t[2]) # 第三 print(t[3:5]) # 四到五 print(t[3:]) # 第三位后(不包括第三) t = t + ('grey', 'orange') # 添加颜色 print(t)
如果有用请采纳,有问题在下面回复