小编ama*_*uth的帖子

使用get_text时,'NoneType'对象不可调用beautifulsoup错误

我编写了这段代码,用于从网页中提取所有文本:

from BeautifulSoup import BeautifulSoup
import urllib2

soup = BeautifulSoup(urllib2.urlopen('http://www.pythonforbeginners.com').read())
print(soup.get_text())
Run Code Online (Sandbox Code Playgroud)

问题是我收到此错误:

print(soup.get_text())
TypeError: 'NoneType' object is not callable
Run Code Online (Sandbox Code Playgroud)

有关如何解决这个问题的任何想法?

python beautifulsoup typeerror

4
推荐指数
1
解决办法
3710
查看次数

标签 统计

beautifulsoup ×1

python ×1

typeerror ×1