title: Reading log file in Python
body: <p>I have a log file with following content.
  I like to read <code>Iteration value</code> and <code>detection_eval</code> value</p>
  
  <pre><code>I0704 18:10:31.097334  2421 solver.cpp:433] Iteration 200, Testing net (#0)
  I0704 18:10:31.149454  2421 net.cpp:693] Ignoring source layer mbox_loss
  I0704 18:10:40.241916  2421 solver.cpp:546]     Test net output #0: detection_eval = 0.00273318
  </code></pre>
  
  <p>I did </p>
  
  <pre><code>accuracy_pattern = r"Iteration (?P&lt;iter_num&gt;\d+), Testing net \(#0\)\n.* detection_eval = (?P&lt;accuracy&gt;[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?)"
  </code></pre>
  
  <p>But nothing is read, what is the issue?</p>
  
  <p>EDIT:
  Then I read accuracy_pattern to array as</p>
  
  <pre><code>for r in re.findall(accuracy_pattern, log):
          iteration = int(r[0])
          accuracy = float(r[1]) * 100
  </code></pre>
  
  <p>log has all file content and read as follow</p>
  
  <pre><code>with open(log_file, 'r') as log_file2:
          log = log_file2.read()
  </code></pre>