title: Read data into 2 dimensional array?
body: <p>I am trying to read a data file into a 2 dimensional array.
  For example:</p>
  
  <p><code>file.dat</code>:</p>
  
  <pre class="lang-none prettyprint-override"><code>1 2 3 a
  4 5 6 b
  7 8 9 c
  </code></pre>
  
  <p>I tried something like:</p>
  
  <pre><code>file=open("file.dat","r")
  
  var = [[]]
  var.append([j for j in i.split()] for i in file)
  </code></pre>
  
  <p>but that didn't work.</p>
  
  <p>I need the data in form of two dimensional array as I need to do operations with each element afterwards, e.g.</p>
  
  <pre><code>for k in range(3):
      newval(k) = var[k,1]
  </code></pre>
  
  <p>Any idea how to do that?</p>