Hey guys, new poster so if I am in the wrong spot please just let me know.
The below code should read the weather off Yahoo, and create a dictionary containing a bunch of variables and their values from the weather (temp = 9 or whatever), it doesn't. How is it possible to read in some XML, parse it, and spit out some variables that make sense?
import xml.etree.ElementTree as et
import urllib2
# get the weather off the web
weather_online = urllib2.urlopen("http://weather.yahooapis.com/forecastrss?p=94089&u=c")
# except, that's an object, make it actual xml
weather_web = weather_online.read()
weather_cache = open(".\weather_cache.xml", "wb")
weather_cache.write(weather_web)
# Parse it
weather_xml = et.XML(weather_web)
# print the actual XML we are working off out
# print weather_web
# and read it into variables
vars = {}
for item in weather_xml:
print item.text
vars[item.tag] = item.text