title: Python append lists into lists
body: <p>I am trying to write a function that goes through a matrix.  When a criteria is met, it remembers the location.</p>
  
  <p>I start with an empty list:</p>
  
  <pre><code>locations = []
  </code></pre>
  
  <p>As the function goes through the rows, I append the coordinates using:</p>
  
  <pre><code>locations.append(x)
  locations.append(y)
  </code></pre>
  
  <p>At the end of the function the list looks like so:</p>
  
  <pre><code>locations = [xyxyxyxyxyxy]
  </code></pre>
  
  <p>My question is:</p>
  
  <p><strong>Using append, is it possible to make the list so it follows this format</strong>:</p>
  
  <pre><code>locations = [[[xy][xy][xy]][[xy][xy][xy]]]
  </code></pre>
  
  <p><strong>where the first bracket symbolizes the locations of a row in the matrix and each location is in it's own bracket within the row?</strong></p>
  
  <p>In this example the first bracket is the first row with a total of 3 coordinates, then a second bracket symbolizing the 2nd row with another 3 coordinates. </p>