I read the similar topic here. I think the question is different or at least .index() couldnot solve my problem.
.index()
This is a simple code in R and its answ
A simple loop will do:
res = [] x = [1,2,3,4,0,1,2,3,4,11] for i in range(len(x)): if check_condition(x[i]): res.append(i)
One liner with comprehension:
res = [i for i, v in enumerate(x) if check_condition(v)]
Here you have a live example