Question
Scape content of http://books.toscrape.com (http://books.toscrape.com) Write a function getData() to scrape title (see (1) in Figure), rating (see (2) in Figure), price (see (3) in
Scape content of http://books.toscrape.com (http://books.toscrape.com)
Write a function getData() to scrape title (see (1) in Figure), rating (see (2) in Figure), price (see (3) in Figure) of all books (i.e. 20 books) listed in the page.
For example, the figure shows one book and the corresponding html code. You need to scrape the highlighted content.
For star ratings, you can simply scrape One, Two, Three, ...
The highlighted content in the figure should be saved into a tuple ('A Light in the
...','Three','51.77')
The output is a list of 20 tuples, e.g. [('A Light in the ...','Three','51.77'), ...]. Each tuple corresponds to one book
A Light n the Attic (2), but get only text from three :DeTore (1) A Light in the .2) href="catalogue/a-light-in-the-attic-1000/ index.html" title="A Light in the Attic" Light in the /a> = $0 a /h3>
2) href="catalogue/a-light-in-the-attic-1000/ index.html" title="A Light in the Attic" Light in the /a> = $0 a /h3>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started