FrontPage

import lxml.etree

doc = lxml.etree.HTML(html_string)
# ... or ...
doc = lxml.etree.XML(xml_string)

doc.xpath("//div[@id='hoge']")[0].text
doc.xpath("//div[@id='hoge']")[0].get("class")  # attribute
doc.xpath("//ns:entry", namespaces={"ns":"http://example.com/test"})  # namespace

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2011-12-12 (月) 23:40:52 (4512d)