In the example we will learn how extract text using BS4, we will use the following HTML file:
We use the BS4 module to get three HTML tags (head, h6 and li). The HTML file above is given as the standard input. Lines 5-6 extracts the data from the stdin and saves into the list variable data.
You can download the index.html file zipped from below:
This hands-on course will teach you Python and BS4 for data and web-scraping. Python online data scraping hands-on with Python 3 and Beautiful Soup version 4.9.