使用 lxml.html 包中的 html5parser 时是否可以不为标签添加命名空间?
例子:
from lxml import html
print(html.parse('http://example.com').getroot().tag)
# You will get 'html'
from lxml.html import html5parser
print(html5parser.parse('http://example.com').getroot().tag)
# You will get '{http://www.w3.org/1999/xhtml}html'
我找到的最简单的解决方案是使用正则表达式删除它,但也许根本不包含该文本?