How to remove every occurrence of sub-list from list
You’d have to implement it yourself. Here is the basic idea: def remove_sublist(lst, sub): i = 0 out = [] while i < len(lst): if lst[i:i+len(sub)] == sub: i += len(sub) else: out.append(lst[i]) i += 1 return out This steps along every element of the original list and adds it to an output list if … Read more