K
K
Korifa2018-09-15 14:10:47
Python
Korifa, 2018-09-15 14:10:47

Why doesn't the parser code work?

if I display the title and the price, it works, but if I add a picture, it displays an empty list

re = requests.get('http://books.toscrape.com')
html = re.text
soups = ba(html, 'lxml')
aa = [(title.string, price.string, images['src']) for title in soups.section.find_all('h3') 
for price in title.find_parents()[0].find('p', class_='price_color')
for images in title.find_parents()[0].find('img')]
print(aa)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question