每天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

浙公网安备 33010602011771号