import urllib import xml.dom.minidom import xml.dom print "Start of program..." print f=urllib.urlopen('http://vegsa24.enterprisedemo-google.com/search?q=googletraining&btnG=Google+Search&access=p&sort=date%3AD%3AL%3Ad1&output=xml_no_dtd&ie=UTF-8&oe=UTF-8&client=default_frontend&site=default_collection&n=5') getTheUrl=f.geturl() print getTheUrl print doc = xml.dom.minidom.parse(f) q= doc.getElementsByTagName('Q')[0].childNodes[0].nodeValue print "The Query: ",q print tm=doc.getElementsByTagName('TM')[0].childNodes[0].nodeValue print "The processing time: ", tm print m=doc.getElementsByTagName('M')[0].childNodes[0].nodeValue print "The estimated number of results: ", m print u=doc.getElementsByTagName('U')[0].childNodes[0].nodeValue print "URL for first result: ", u print t=doc.getElementsByTagName('T')[0].childNodes[0].nodeValue print "Title of first results: ", t print u2=doc.getElementsByTagName('U')[1].childNodes[0].nodeValue print "URL for second result: ", u2 print t2=doc.getElementsByTagName('T')[1].childNodes[0].nodeValue print "Title of second result: ", t2 print print print "End of program"