i have installed lxml2.2.2 on windows platform(i m using python version 2.6.5).i tried this simple command:
from lxml.html import parse p= parse(‘http://ww
Since line breaks are not allowed in comments, here's my implementation of MattH's answer:
from urllib2 import urlopen from lxml.html import parse site_url = ('http://www.google.com') try: page = parse(site_url).getroot() except IOError: page = parse(urlopen(site_url)).getroot()