title: How to get a split up a list of numbers and insert into another list
body: <p>Currently I have a file with 6 rows of numbers and each row containing 9 numbers.  The point is to test each row of numbers in the file if it completes a magic square.  So for example, say a row of numbers from the file is 4 3 8 9 5 1 2 7 6.  The first three numbers need to be the first row in a matrix.  The next three numbers need to be the second row, and same for the third.
  Therefore you would need to end up with a matrix of:
  [['4','3','8'],['9','5','1'],['2','7','6']]</p>
  
  <p>I need to test the matrix to see if it is a valid magic square (Rows add up to 15, columns add to 15, and diagonals add to 15).  </p>
  
  <p>My code is currently:</p>
  
  <pre><code>def readfile(fname):
      """Return a list of lines from the file"""
      f = open(fname, 'r')
      lines = f.read()
      lines = lines.split()
      f.close()
      return lines
  
  def assignValues(lines):
      magicSquare = []
      rows = 3
      columns = 3
      for row in range(rows):
          magicSquare.append([0] * columns)
      for row in range(len(magicSquare)):
          for column in range(len(magicSquare[row])):
              magicSquare[row][column] = lines[column]
      return magicSquare
  
  def main():
      lines = readfile(input_fname)
      matrix = assignValues(lines)
      print(matrix)
  </code></pre>
  
  <p>Whenever I run my code to test it, I'm getting:</p>
  
  <pre><code>[['4', '3', '8'], ['4', '3', '8'], ['4', '3', '8']]
  </code></pre>
  
  <p>So as you can see I am only getting the first 3 numbers into my matrix.<br>
  Finally, my question is how would I go by continuing my matrix with the following 6 numbers of the line of numbers?  I'm not sure if it is something I can do in my loop, or if I am splitting my lines wrong, or am I completely on the wrong track?</p>
  
  <p>Thanks.</p>