python基础数据类型tuple
tu = (1,2,'abc',[1,'a','b',2]) for i in tu: print(i) tu[3].append('ccc') print(tu) # (1, 2, 'abc', [1, 'a', 'b', 2, 'ccc'])
元祖的拆包 l = (11,22) a,b=l print(a,b) #11 22 ''' count ''' tu = (1,1,1,1,2,2,3,3,4,4,5) print(tu.count(1)) # 4 ''' index ''' tu = (1, 2, 'abc', [1, 'a', 'b', 2]) print(tu.index('abc')) # 2