我在修改BS4和web抓取,当我处理它时,变量变为空白
<!-- example.html -->
<html><head><title>The Website Title</title></head>
<body>
<p>Download my <strong>Python</strong> book from <a href="http://
inventwithpython.com">my website</a>.</p>
<p class="slogan">Learn Python the easy way!</p>
<p>By <span id="author">Al Sweigart</span></p>
</body></html>
import bs4
example = open('example.html')
soup = bs4.BeautifulSoup(example.read())
print(soup) # returns '[]'
目前没有回答
相关问题 更多 >
编程相关推荐