title: How to remove every occurrence of sub-list from list
body: <p>I have two lists:</p>
  
  <pre><code>big_list = [2, 1, 2, 3, 1, 2, 4]
  sub_list = [1, 2]
  </code></pre>
  
  <p>I want to remove all sub_list occurrences in big_list.</p>
  
  <p>result should be <code>[2, 3, 4]</code></p>
  
  <p>For strings you could use this:</p>
  
  <pre><code>'2123124'.replace('12', '')
  </code></pre>
  
  <p>But AFAIK this does not work for lists.</p>
  
  <p>This is not a duplicate of <a href="https://stackoverflow.com/questions/42881650/removing-a-sublist-from-a-list">Removing a sublist from a list</a> since I want to remove all sub-lists from the big-list. In the other question the result should be <code>[5,6,7,1,2,3,4]</code>.</p>
  
  <p>Update: For simplicity I took integers in this example. But list items could be arbitrary objects.</p>
  
  <p>Update2:</p>
  
  <p>if <code>big_list = [1, 2, 1, 2, 1]</code> and <code>sub_list = [1, 2, 1]</code>, 
  I want the result to be <code>[2, 1]</code> (like <code>'12121'.replace('121', '')</code>)</p>
  
  <p>Update3:</p>
  
  <p>I don't like copy+pasting source code from StackOverflow into my code. That's why I created second question at software-recommendations: <a href="https://softwarerecs.stackexchange.com/questions/51273/library-to-remove-every-occurrence-of-sub-list-from-list-python">https://softwarerecs.stackexchange.com/questions/51273/library-to-remove-every-occurrence-of-sub-list-from-list-python</a></p>
  
  <p>Update4: if you know a library to make this one method call, please write it as answer, since this is my preferred solution. </p>
  
  <p>The test should pass this test:</p>
  
  <pre><code>def test_remove_sub_list(self):
      self.assertEqual([1, 2, 3], remove_sub_list([1, 2, 3], []))
      self.assertEqual([1, 2, 3], remove_sub_list([1, 2, 3], [4]))
      self.assertEqual([1, 3], remove_sub_list([1, 2, 3], [2]))
      self.assertEqual([1, 2], remove_sub_list([1, 1, 2, 2], [1, 2]))
      self.assertEquals([2, 1], remove_sub_list([1, 2, 1, 2, 1], [1, 2, 1]))
      self.assertEqual([], remove_sub_list([1, 2, 1, 2, 1, 2], [1, 2]))
  </code></pre>