title: Inserting values into a list whilst looping over it (Python)
body: <p>I have the following list of lists:</p>
  
  <pre><code>sweet = [['1234-4321-1',[5, 6, -4, 11, 22]], ['1234-7834-1', [43, -5, 0, 0, -1]], ['1234-5376-1', [3, 0, -5, -6, 0]], ['1567-3454-1', [4, 6, 8, 3, 3]], ['1567-9987-1-', [1, 2, 1, -4, 5]]]
  </code></pre>
  
  <p>I wish to iterate over the list of lists and separate the different groups of sublists by the # character i.e. I wish the # to be inserted when the first element of the sublists string changes.</p>
  
  <p>desired result</p>
  
  <pre><code>&gt;&gt;sweet
  &gt;&gt;[['1234-4321-1',[5, 6, -4, 11, 22]], ['1234-7834-1', [43, -5, 0, 0, -1]], ['1234-5376-1', [3, 0, -5, -6, 0]], '#', ['1567-3454-1', [4, 6, 8, 3, 3]], ['1567-9987-1-', [1, 2, 1, -4, 5]]]
  </code></pre>
  
  <p>Trivial task perhaps but I am very new to Python, help much appreciated.</p>
  
  <p>EDIT</p>
  
  <p>I am awaret hat perhaps a dictionary now would be a better data structure and hence the '#' key may not be needed, I was aiming to use it as a separtor of the stations (first number in the string) so that I could do computations of the stations in isolation whilst iterating over the list.</p>
  
  <p>My goal you see is to iterate over the list (should make it a dictionary) and compute the difference between pairs of lists of ints within each important first number.    Desired final result looking like: {'1234': [[-38, 11, -4, 11, 23], [40, -5, 5, 6, -1]] '1567':[[3, 4, 7, 11, -2]] }</p>
  
  <p>Any help on this also much appreciated :)</p>