python爬虫中如果有两个相同的class标签,而爬取目标为第二个,如何解决
book_data = soup.find('div',class_='box_con').find_all('a')
for book_info in book_data:
book_titil = book_info.text
book_url = book_info['href']
python爬虫中如果有两个相同的class标签,而爬取目标为第二个,如何解决
book_data = soup.find('div',class_='box_con').find_all('a')
for book_info in book_data:
book_titil = book_info.text
book_url = book_info['href']
soup.find_all('div',class_='box_con')[1]
这样呢