小编Sky*_*son的帖子

“str”对象没有属性“find_all”漂亮的汤

这就是我的代码,非常简单。由于某种原因,出现上述错误。即使我删除text = str(html)并替换soup = BeautifulSoup(text, 'html.parser')为同样的错误soup = BeautifulSoup(html, 'html.parser')。这是怎么回事?

with urllib.request.urlopen('https://jalopnik.com/search?q=mazda&u=&zo=-07:00') as response:
   html = response.read()  
text = str(html)  
soup = BeautifulSoup(text, 'html.parser')
print(type(soup))
soup = soup.prettify()
print(soup.find_all('div')) 
Run Code Online (Sandbox Code Playgroud)

python beautifulsoup

-1
推荐指数
1
解决办法
1万
查看次数

标签 统计

beautifulsoup ×1

python ×1