count方法原型:
list.count(x)
是用来统计列表元素x的个数
ls = [66.25, 333, 333, 1, 1234.5]
print ls.count(333) #2
index方法原型:
list.index(x)
是用来返回x元素在列表中第一次出现的位置下标
ls.index(333) #1
转载于:https://blog.51cto.com/cpper/1963027
count方法原型:
list.count(x)
是用来统计列表元素x的个数
ls = [66.25, 333, 333, 1, 1234.5]
print ls.count(333) #2
index方法原型:
list.index(x)
是用来返回x元素在列表中第一次出现的位置下标
ls.index(333) #1
转载于:https://blog.51cto.com/cpper/1963027