首页 > TAG信息列表 > 上山
元组
##元组列表-[元素1,元素2,元素3,。。。。]元组-(元素1,元素2,元素3,。。。。)支持count和index方法。 #代码:rhyme = (1,2,3,4,5,"上山打老虎")rhyme(1, 2, 3, 4, 5, '上山打老虎')rhyme = 1,2,3,4,5,"上山打老虎"rhyme(1, 2, 3, 4, 5, '上山打老虎')rhyme[0]1rhyme[-1]'上山打老虎'rhy5_元组
a = (1, 2, 3, 4, 5, "上山打老虎") # (1, 2, 3, 4, 5, '上山打老虎') print(a) # 4 print(a[3]) # (1, 2, 3, 4, 5, '上山打老虎') print(a[:]) # (1, 3, 5) print(a[::2]) # ('上山打老虎', 5, 4, 3, 2, 1) print(a[::-1]) s = (1, 2, 3) t = (4, 5, 6