元组学习
作者:互联网
#关键字tuple tuple1=(1,2,3,3,3,3,3,4) # 检索元素重复个数(count) print(tuple1.count(3)) 结果:5 #索引位置(index) print(tuple1.index(4)) 结果:7 tuple2=("go","to") # 检索元素重复个数(count) print(tuple2.count("go")) 结果:1 #索引位置(index) print(tuple1.index("to")) 结果:1
标签:count,index,元组,学习,tuple1,tuple2,go,print 来源: https://www.cnblogs.com/wrwangrong/p/16394355.html