[英]WebScraping With BS4, AttributeError with Find_all
这是我正在运行的代码。
import bs4
import requests
from bs4 import BeautifulSoup
r=requests.get('https://finance.yahoo.com/quote/SAS.ST/?guccounter=1')
soup=bs4,BeautifulSoup(r.text,"xml")
soup.find_all('div')
当我运行它时,output 是
> Traceback (most recent call last): File
> "/Users/darre/Desktop/script.py3", line 8, in <module>
> bi=soup.find_all('div') AttributeError: 'tuple' object has no attribute 'find_all'
这是错误,请使用soup=BeautifulSoup(r.text,"lxml")
代替
soup=bs4,BeautifulSoup(r.text,"xml")
BeautifulSoup 使用不同的解析器细节在这里解析器描述在这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.