b = [0,1,2,3,4,5,6,5] index = [i for i,x in enumerate(b) if x==5] print(index) 返回所有等于5的元素的索引 b.index(5)这种方法只能返回第一个