# Based on recipe 79: Get the temperature off a weather page (on file)

def findTemperature():

  weatherFile = getMediaPath("bom_act_forecast.htm")
  file = open(weatherFile,"rt")
  weather = file.read()
  file.close()

  # Find the Temperature
  curloc = weather.find("Max ")
  if curloc <> -1:

    # Now, find the new line "\n" following the temp
    tempstart = curloc+4  # Position after "Max "
    tempend = weather.find("\n", tempstart)
    print "Current temperature:",weather[tempstart+1:tempend]

  if curloc == -1:
    print "They must have changed the page format -- can't find the temp"

