因为class是python的关键字,所以在写过滤的时候,应该是这样写:

r = requests.get(web_url, headers=headers)  # 向目标url地址发送get请求,返回一个response对象
all_a = BeautifulSoup(r.text, 'lxml').find_all('a', class_='cV68d')  # 获取网页中的class为cV68d的所有a标签

这里总结:

凡是在[]外面的都是class_,[]里面的都是class

相关文章:

  • 2021-10-11
  • 2021-05-25
  • 2022-01-13
  • 2022-12-23
  • 2022-01-07
猜你喜欢
  • 2021-08-07
  • 2021-10-14
  • 2021-06-12
  • 2021-11-09
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案