Python BeautifulSoup find()不接受关键字参数错误
我在观看在线学习时输入了这段代码,但在循环中它总是出错。 con=i.find('a',class='sh\u blog\u title\u sp\u each\u url\u sp\u each\u title')。获取文本()Python BeautifulSoup find()不接受关键字参数错误,python,selenium,beautifulsoup,Python,Selenium,Beautifulsoup,我在观看在线学习时输入了这段代码,但在循环中它总是出错。 con=i.find('a',class='sh\u blog\u title\u sp\u each\u url\u sp\u each\u title')。获取文本() 此行显示错误“find()不接受关键字参数”请改用.find('a',attrs={“class”:“})。参考资料:这两个链接肯定会对您有所帮助 问题是,您必须使用.find_all()来获取所有标记.find()仅返回一个标记(如果有): 印刷品: imp
此行显示错误“find()不接受关键字参数”请改用
.find('a',attrs={“class”:“})
。参考资料:这两个链接肯定会对您有所帮助
问题是,您必须使用
.find_all()
来获取所有
标记.find()
仅返回一个标记(如果有):
印刷品:
import requests
from bs4 import BeautifulSoup
url = 'https://search.naver.com/search.naver?query=tree&where=post&sm=tab_nmr&nso='
full_html = requests.get(url).content
soup = BeautifulSoup(full_html, 'html.parser')
content_list = soup.find_all('a', class_='sh_blog_title _sp_each_url _sp_each_title' )
for i in content_list:
print(i.text)
print('\n')
import requests
from bs4 import BeautifulSoup
url = 'https://search.naver.com/search.naver?query=tree&where=post&sm=tab_nmr&nso='
full_html = requests.get(url).content
soup = BeautifulSoup(full_html, 'html.parser')
content_list = soup.find_all('a', class_='sh_blog_title _sp_each_url _sp_each_title' )
for i in content_list:
print(i.text)
print('\n')
[2017/공학설계 입문] Romantic Tree
장충동/Banyan Tree Club & Spa/Club Members Restaurant
2020-06-27 Joshua Tree National Park Camping(조슈아트리...
[결혼준비/D-102] 웨딩밴드 '누니주얼리 - like a tree'
Book Club - Magic Tree House # 1 : Dinosaur Before Dark...
비밀 정원, 조슈아 트리 국립공원(Joshua Tree National Park)
그뤼너씨 TEA TREE 티트리 라인 3종리뷰
Number of Nodes in the Sub-Tree With the Same Label
태국의 100년 넘은 Giant tree
[부산 기장 카페] 오션뷰 뷰맛집카페 : 씨앤트리 sea&tree