是否有内置包可以将 html 解析为 dom?
问题描述:
我找到了用于 SAX 的 HTMLParser
和用于 XML 的 xml.minidom
.我有一个格式很好的 HTML,所以我不需要太强大的解析器 - 有什么建议吗?
I found HTMLParser
for SAX and xml.minidom
for XML. I have a pretty well formed HTML so I don't need a too strong parser - any suggestions?
答
看看 BeautifulSoup一>.它在解析 HTML 方面很受欢迎且非常出色.
Take a look at BeautifulSoup. It's popular and excellent at parsing HTML.