title: Apache log file parsing via Python
body: <p>I am making a python log parser script where I need to count the number of logs whose status code is 200 from a log file.</p>
  
  <p>Here are some of the logs from the file:</p>
  
  <pre><code>120.115.144.240 - - [29/Aug/2017:04:40:03 -0400] "GET /apng/assembler-2.0/assembler2.php HTTP/1.1" 404 231 "http://littlesvr.ca/apng/history.html" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36"
  
  202.167.250.99 - - [29/Aug/2017:04:41:10 -0400] "GET /apng/images/o_sample.png?1424751982?1424776117 HTTP/1.1" 200 115656 "http://bbs.mydigit.cn/read.php?tid=2186780&amp;fpage=3" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36"
  
  14.152.69.236 - - [29/Aug/2017:04:41:41 -0400] "GET /apng/images/o_sample.png?1424751982?1424776117 HTTP/1.1" 304 - "http://bbs.mydigit.cn/read.php?tid=2205351" "Mozilla/5.0 (Linux; U; Android 7.1.2; zh-CN; NX510J Build/NJH47D) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.2214.89 UCBrowser/11.6.6.951 Mobile Safari/537.36"
  
  60.4.236.27 - - [29/Aug/2017:04:42:46 -0400] "GET /apng/images/o_sample.png?1424751982?1424776117 HTTP/1.1" 200 115656 "http://bbs.mydigit.cn/read.php?tid=1952896" "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36"
  
  58.62.17.190 - - [29/Aug/2017:04:50:01 -0400] "GET /apng/gif_apng_webp1.html HTTP/1.1" 200 935 "http://dev.qq.com/topic/582939577ef9c5b708556b0d" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
  </code></pre>
  
  <p>I have tried this code but the only output I'm getting is a long list of closed brackets <code>[]</code>:</p>
  
  <pre><code>#!/usr/bin/env python3
  
  import sys
  import re
  
  f = open('accesslogfile', 'r')
  print('Reading log files... done.')
  nooflines = f.readlines()
  
  for line in nooflines:    
      regex = re.match(r'\d{200}\s', line)
      print(regex)
  f.close()
  </code></pre>
  
  <p>In this case, I know the output should be <code>3</code> (As there are only three logs that have the status code 200) but I can't seem to get it. Any help would be appreciated.</p>
  
  <p>Thanks :)</p>