每天CookBook之Python-100

  • 使用命名空间解析xml
from xml.etree.ElementTree import parse

doc = parse('07.xml')

print(doc.findtext(
    'content/{http://www.w3.org/1999/xhtml}html/{http://www.w3.org/1999/xhtml}head/{http://www.w3.org/1999/xhtml}title'))
Hello World
posted @ 2016-07-29 21:19  4Thing  阅读(91)  评论(0)    收藏  举报