Scraping and Parsing Text From Websites Exercise
00:00
Here is your first exercise task. You are meant to write a program that grabs the full HTML from the following URL using Python’s built-in urllib
library.
00:12
And then you see the URL, which points to a specific profile on that Mount Olympus page that you have seen before. And specifically, you want to scrape the profile of dionysus
in this case.
00:23
And once you have scraped the HTML, you should use the .strfind()
method on the resulting string object to display the text that comes after first the name and then the favorite color.
00:34 So you want to pick out these two specific pieces of information and really just display the info that’s noted there on Dionysus’ profile page, basically without any leading spaces or trailing HTML text.
00:49 So you want to clean it up so that then you just get Dionysus and his favorite color as the result.
00:55
And note that you should only use Python standard library to complete this task, right? So that means the built-in urllib
library and then string methods.
01:05 There are other ways to do this, of course, and later in the course you’ll tackle this in other exercises. But for this first one, stick with the standard library.
01:13 Okay, so now go ahead and solve this task for yourself. And once you are done or if you get stuck, you can move on to the next lesson where you can watch me and my approach to solving the challenge.
Become a Member to join the conversation.