有没有更快的方法来实现这个功能?
def minIndex(array):
minarray = min(array)
min_index = []
for item in range(len(array)):
if array[item] == minarray:
min_index.append(item)
return min_index
array = [0, -1, -1, -1, 0, 1, -2, 1, 1, 1, 0, 3, -2, 1, 0, 0, 0, 0, -1, 0, -1, -2]
minIndex(array)
[6, 12, 21]