Divvy Up This Exercise
We have pre-loaded an HTML into the string variable html
. In this two part problem you will use this html
variable as the HTML document to set up a Selector
object with, and create a SelectorList
which selects all div
elements; then, you will check your understanding of what happens within the SelectorList
.
This exercise is part of the course
Web Scraping in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
from scrapy import Selector
# Create a Selector selecting html as the HTML document
sel = Selector( ____ )
# Create a SelectorList of all div elements in the HTML document
divs = sel.xpath( ____ )