#! /usr/bin/python import urllib from xml.dom import minidom # Change your id here url = 'http://weather.yahooapis.com/forecastrss?w=<>&u=c' dom = minidom.parse(urllib.urlopen(url)) condition = dom.getElementsByTagName("yweather:condition")[0] out = 'Now: %s, %s' % ( condition.getAttribute('temp').rjust(2), condition.getAttribute('text') ) print out out += "\n" for day in dom.getElementsByTagName("yweather:forecast"): line = "%s: %s to %s, %s" % ( day.getAttribute('day'), day.getAttribute('low').rjust(2), day.getAttribute('high').rjust(2), day.getAttribute('text') ) print line out += line + "\n" handle = open('/tmp/weather', 'w+') handle.write(out) handle.close()