title: TypeError: list indices must be integers, not list. How to fix?
body: <p>There's the code with the TypeError in it. "list indices must be integers, not list", though they are integers. I'd appreciate you helping me figure out what's wrong.  What I need is to get matrix 7x5 from source 7x5 tab with different values. The error occurs on the last line.</p>
  
  <pre><code>lines = []
  
  with open("text.txt") as f:
      for line in f:
          line = [int(x) for x in line if (x != ' ') and (x != '\n')]
          lines.append(line)
      f.close()
  </code></pre>
  
  <p>What I have after reading file is list of lists with numbers called "lines". It's integers. Not strings. Like:</p>
  
  <pre><code>&gt;&gt; [[1, 2, 3...], [4, 5, 6...], [7, 8, 9...],[...]]
  
  
  i = 1
  j = 1
  T = []
  T.append(lines[0][0]) 
  </code></pre>
  
  <p>I made this for avoiding <code>IndexError</code> (list out of range) on last line (<code>i-1</code> and stuff). Though, I don't think it's python-way really. I'd appreciate help with this thing too.</p>
  
  <pre><code>for i in lines:
      for j in lines:
          T[i][j] = lines[i][j] + max(T[i][j-1], T[i-1][j])
  </code></pre>
  
  <p>This is where error occurs. I don't get what should I fix if <code>i</code>, <code>j</code> are already <code>int</code>.</p>