I want to remove a value from a list if it exists in the list (which it may not).
a = [1, 2, 3, 4] b = a.index(6) del a[b] print(a)
The abov
this is my answer, just use while and for
def remove_all(data, value): i = j = 0 while j < len(data): if data[j] == value: j += 1 continue data[i] = data[j] i += 1 j += 1 for x in range(j - i): data.pop()