title: Writing python script to read access log file
body: <p>I have an accesslog file with following data format:</p>
  
  <pre><code>10.183.252.22 - - [18/May/2014:00:06:06 -0700] GET
  /main/page_res/mon/imp?id=11062&amp;amp;cpnsite_id=29374&amp;amp;bid=0.3 HTTP/1.1 3
  </code></pre>
  
  <p>I need to add all bid values (which in this case is 0.3) of 3 given hours to a variable. For example, <strong>sum of all bid values between 3 PM to 6 PM.</strong></p>
  
  <p><strong>UPDATE:</strong>
  I have written the code and it is working. Now I just need to know whether this is a good way to do this or there is a better way?</p>
  
  <p>OR any possible betterments in this code?</p>
  
  <p>Code:</p>
  
  <pre><code>with open("log_file.txt") as f:
      total_bid = 0 
      while True: 
          line = f.readline() 
          string = line
          time = string.split(" ") [3]
          hour = time.split(":") [1]
          hour = int(hour)
  
          if hour &gt; 6:   #no need to read logs of later hrs.
              break
          else:
              pass
  
          if hour &gt;= 03 and hour &lt; 06:
              bid_str = string.split(" ") [6]
              bid = bid_str.split (";") [2]
              bid_price = bid.split("=") [1]
              bid_price = float(bid_price)
              total_bid = total_bid + bid_price
              print total_bid 
          else: 
              pass    
  </code></pre>