# 分享一下网络爬虫python源代码,具体代码如下所示: import requests from bs4 import BeautifulSoup # 定义请求页面的URL URL = 'http://books.toscrape.com/' page = requests.get(URL) soup = BeautifulSoup(page.content, 'html.parser') # 找出所有的书的标题 books = soup.find_all('article', class_='product_pod') # 遍历所有的书,打印其标题 for book in books: book_name = book.h3.a["title"] print(book_name)