x = [1, 1, 1, 2, 2, 2, 3, 3, 3]
[i for i in range(1, len(x)) if x[i] != x[i - 1]]
x = [1, 1, 1, 2, 2, 2, 1, 1, 1]
[i for i in range(1, len(x)) if x[i] != x[i - 1]]
Track value changes in a repetitive list in Python