course content

Course Content

Web Scraping with Python

Navigating HTML DocumentNavigating HTML Document

Once you have read the HTML document, you can navigate it in various ways. First, you can 'dig deeper' by specifying the tag just like an attribute. For instance, let's inspect the <head> element and represent it in a 'structure' form (by using the .prettify() method).

Feel free to experiment by changing the .head attribute to .body, for instance. As you can see above, the <head> element contains several children. You can iterate over all elements' children by using the for loop and the .children attribute.

Section 2.

Chapter 2