擅长:python、mysql、java
<p>正如Markku在评论中建议的那样,我建议将代码分解。在</p>
<pre><code>from BeautifulSoup import BeautifulSoup
import urllib2
URL = "http://www.pythonforbeginners.com"
page = urllib2.urlopen('http://www.pythonforbeginners.com')
html = page.read()
soup = BeautifulSoup(html)
print(soup.get_text())
</code></pre>
<p>如果它仍然不起作用,就加入一些打印语句,看看发生了什么。在</p>
^{pr2}$