title: Check if a line in a file starts with a specific string - do some calculations
body: <p>So this is what im trying to do:</p>
  
  <p>I have a huge file. I want to open it in python and look at each line, if it matches a certain predetermined string I want to get the number that comes immediately after that string, add them all up and get the average.</p>
  
  <p>the file looks like this:</p>
  
  <pre><code>`$` Data
  `$` Number of hours: 34
  `$` DATA
  `$` Number of hours: 56
  `$` DATA3
  `$` MoreDATA
  `$` MOREDATA
  `$` Number of hours: 9
  </code></pre>
  
  <p>I want to add 34 + 56 + 9 and then get the average.</p>
  
  <p>So far this is what I have:</p>
  
  <hr>
  
  <pre><code>#fname = raw_input("Enter file name: ")
  fh = open("data.txt")
  
  
  fhread = fh.readlines()
  #fhstrip = fhread.rstrip()
  #fhstripz = fhstrip.lstrip()
  
  findz = "Number of hours:"
  
  for line in fhread:
      if line.startswith(findz)
      print line
      #print saved
      #spose = line.find('', atpos)
  
  
  fh.close()    
  
  print "Done"    
  </code></pre>
  
  <hr>
  
  <p>I dont know if I should use <code>.read()</code> or <code>.readlines()</code> ----When I use readlines it does not let me do <code>rstrip</code> and <code>lstrip</code></p>
  
  <p>Please help find all instances of the line with "Number of hours"</p>