FrontPage
import lxml.etree doc = lxml.etree.HTML(html_string) doc.xpath("//div[@id='hoge']")[0].text doc.xpath("//div[@id='hoge']")[0].get("class") # attribute