title: Best way to parse matrix in python from a logfile
body: <p>I have a matrix printed inside a log file this way:</p>
  
  <pre><code>[[ 73.1   0.7   5.3   3.7   3.5   1.    0.9   1.3   8.8   1.7]
  [  1.9  76.5   1.1   1.6   1.2   0.9   2.4   0.3   5.9   8.2]
  [  4.2   0.3  64.5   5.7   9.1   5.9   6.5   2.7   1.    0.1]
  [  2.2   0.5   9.4  49.4   9.6  15.6   8.5   3.3   1.2   0.3]
  [  1.5   0.1   9.    5.3  71.3   3.5   4.8   3.7   0.8   0. ]
  [  1.    0.4   7.7  15.9   6.5  59.5   4.4   3.7   0.7   0.2]
  [  0.1   0.3   7.    5.6   3.8   2.2  80.3   0.5   0.2   0. ]
  [  1.    0.2   6.3   4.5  11.2   6.2   0.9  69.1   0.2   0.4]
  [  6.2   0.7   1.7   2.3   1.6   0.6   1.    0.4  84.    1.5]
  [  4.3   8.6   1.9   3.7   1.3   1.2   1.7   1.9   4.4  71. ]]
  .... some text and then again another matrix ......
  [[ 71.9   0.6   8.1   2.    1.    1.9   2.    1.6   8.4   2.5]
   [  1.2  82.9   1.1   1.1   0.5   1.3   1.5   0.7   3.9   5.8]
   [  4.7   0.9  59.6   4.1   7.6  10.    7.3   3.8   1.5   0.5]
   [  2.3   0.7   6.5  43.1   6.8  24.5   7.4   4.    2.6   2.1]
   [  1.7   0.3   5.6   5.4  62.5   7.4   6.5   9.3   1.    0.3]
   [  1.4   0.2   6.   12.7   5.3  64.4   3.3   5.4   0.8   0.5]
   [  0.7   0.6   5.5   4.9   3.9   4.5  78.2   0.6   0.8   0.3]
   [  1.7   0.2   4.5   3.4   4.4   7.6   1.   76.    0.7   0.5]
   [  6.3   1.9   1.7   1.4   0.8   0.9   1.4   0.4  83.    2.2]
   [  3.4   8.6   1.4   1.2   0.8   1.3   0.9   2.4   3.8  76.2]]
  </code></pre>
  
  <p>I tried doing this to read the first matrix and then append it to a list of matrices:</p>
  
  <pre><code>with open('log.txt') as f:
      for line in f:
          for i in range(N):
              cnf_mline = f.next().strip()
              cnf_mvalue = cnf_mline[cnf_mline.rfind('[')+1:]
              cnf_mtx.append(map(float, (cnf_mvalue,)))
          print cnf_mline
          print cnf_mvalue
  </code></pre>
  
  <p>and I see the following error:</p>
  
  <pre><code>ValueError: invalid literal for float(): 73.1   0.7   5.3   3.7   3.5   1.    0.9   1.3   8.8   1.7]
  </code></pre>
  
  <p>How do I parse this matrix directly from the log file to a list?</p>
  
  <p>Thanks in advance !</p>