
Juan Jose Aparicio Aparicio
PreguntaCon BeautifulSoup se puede trabajar con selectores xpath, como con Scrapy o solo selectores CSS?

Juan Ordoñez
Si se puede, pero no nativamente con BeautifulSoup sino con una biblioteca llamada lxml, te pongo un pequeño codigo de ejemplo.
<code> import urllib2 from lxml import etree url = "http://www.example.com/servlet/av/ResultTemplate=AVResult.html" response = urllib2.urlopen(url) htmlparser = etree.HTMLParser() tree = etree.parse(response, htmlparser) tree.xpath(xpathselector)