title: How to slice list into contiguous groups of non-zero integers in Python
body: <p>Can't seem to find a clue to this online and can't figure it out myself so:</p>
  
  <p>How would I go about slicing a list so that I return a list of slices of contiguous non-zero integers. ie:</p>
  
  <pre><code>data = [3, 7, 4, 0, 1, 3, 7]
  </code></pre>
  
  <p>and I want to produce:</p>
  
  <pre><code>slices = [[3, 7, 4], [1, 3, 7]]
  </code></pre>
  
  <p>I have tried various methods of iterating through the list, have been leaning towards a generator that lets me know when the contiguous groups start and stop, by testing if there is a 0 before or after, but then I am a bit stumped.</p>