That is not an error, that just means than nothing is being printed out at all. You didnt find the href's
try this code:
try this code:
import requests from bs4 import BeautifulSoup def trade_spider(max_pages): page = 1 while page <= max_pages: url = 'http://books.toscrape.com/catalogue/page-{}.html'.format(page) source_code = requests.get(url) plain_text = source_code.text soup = BeautifulSoup(plain_text, "html.parser") books = soup.find_all('li', {'class':'col-xs-6 col-sm-4 col-md-3 col-lg-3'}) for book in books: a = book.find('a') link = a['href'] title = a.find('img')['alt'] print(link) print(title) page += 1 trade_spider(1)
Recommended Tutorials: