title: Read flat list into multidimensional array/matrix in python
body: <p>I have a list of numbers that represent the flattened output of a matrix or array produced by another program, I know the dimensions of the original array and want to read the numbers back into either a list of lists or a NumPy matrix. There could be more than 2 dimensions in the original array.</p>
  
  <p>e.g.</p>
  
  <pre><code>data = [0, 2, 7, 6, 3, 1, 4, 5]
  shape = (2,4)
  print some_func(data, shape)
  </code></pre>
  
  <p>Would produce:</p>
  
  <p>[[0,2,7,6],
   [3,1,4,5]]</p>
  
  <p>Cheers in advance</p>