title: Python: read file, store rows as list and create list of rows
body: <p>I have a data file with a certain amount of rows and columns that I import. I want to store the values of each row in a list and finally create a list consisting of the lists of each row, e.g. a simplified version:</p>
  
  <p>Input:</p>
  
  <pre><code>1 2 3
  4 5 6
  7 8 9
  </code></pre>
  
  <p>And as outcome I want </p>
  
  <pre><code>[[1,2,3],[4,5,6],[7,8,9]]
  </code></pre>
  
  <p>My code atm:</p>
  
  <pre><code>result = []
  col1 = []
  for line in lines[1:]:
  
      # split the line into fields based on white space
      fields = line.split()
  
      # convert the text to numbers, make list of values in row k
      while k &lt; real: 
          col = float(fields[k])
          col1.append(col)
          k+=1
  
      else:
          result.append(col1)  #make list of lists of values in rows
          k=0                 #Reset k for other loop using k
          del col1[:]        #Delete temp list
  
          print result
  </code></pre>
  
  <p>For some reason after del col1[:], result also gets emptied. Any idea why this is? </p>
  
  <p>Any suggestions on how to do this in a more simplified way are always welcome! As you'll probably have noticed, I'm not that experienced with python.</p>
  
  <p>Note that in my real case I have a data-file with 100 columns and 108k rows.</p>
  
  <p>Thanks in advance!</p>