Getting ready

Let's start examining CSS selectors using the same start up code we used in the last recipe.  These code snippets are also in the 02/04_css_selectors.py.

In [1]: from lxml import html   ...: import requests   ...: page_html = requests.get("http://localhost:8080/planets.html").text   ...: tree = html.fromstring(page_html)   ...:

Get Python Web Scraping Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.