我正在学习BeautifulSoup。它没有正确地阅读一些网站。我发现原因是某些html属性格式不正确。例如:
from bs4 import BeautifulSoup
html = """
<html>
<head><title>Test</title></head>
<body>
<p id="paraone"align="center">some content <b>para1</b>.<!--there is no space before 'align' attribute -->
<p id="paratwo" align="blah">some content <b>para2</b>
</html>
"""
soup = BeautifulSoup(html)
print "soup:", soup
我认为BeautifulSoup旨在不读取格式错误的HTML。如果是这样,有没有其他模块来阅读上面给出的HTML?我们难道不能解析形式错误的网站吗?