我在学美体。它没有正确地阅读一些网站。我发现原因是一些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
我认为我的设计不是为了美化html。如果是这样的话,有没有其他模块来读取上面给定的html?我们不能解析格式错误的网站吗?在
目前没有回答
相关问题 更多 >
编程相关推荐