请检查您是否正确导入了BeautifulSoup库并创建BeautifulSoup对象。如果是,请确保您在使用find_all()命令时正确指定了标签名和属性值。
示例代码:
import requests from bs4 import BeautifulSoup
url = 'https://example.com' response = requests.get(url) soup = BeautifulSoup(response.content, "html.parser")
div_list = soup.find_all('div')
img_list = soup.find_all('img', {'class': 'thumbnail'})
上一篇:BeautifulSoup无法识别select标签上的name属性的值
下一篇:BeautifulSoup无法使用if is None则继续语句来避免'NoneType'对象不可订阅的类型错误。