From the course: Learning the Python 3 Standard Library
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Python HTML parser module - Python Tutorial
From the course: Learning the Python 3 Standard Library
Python HTML parser module
- [Instructor] Let's use the HTML Parson module to parser some HTML code in Python. And so in order to parse HTML code, we have to import the HTML parser module, and so to do this, we'll go from html.parser, and from this parser we'll import the HTMLParser class. However, before we get into parsing, let's review some HTML. In HTML we have two types of tags, opening tags and closing tags. Here, we have an opening paragraph tag which starts a paragraph, and the closing paragraph tag that ends a paragraph. We also have comments in HTML that are like notes to the developer, and then we have a full line of code with an opening each one tag, hi there as our data, and then a closing header one tag. Here, we're going to create a new class that inherits from the HTMLParser class, and then we're going to overwrite some methods from the inheriting class. And so we're going to go class HTMLParser, and then we're inheriting…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Getting the current time with Python2m 7s
-
(Locked)
Formatting dates and times in Python with datetime3m 46s
-
(Locked)
Calculating future times and Python calendar module3m 26s
-
(Locked)
Create a timer with the Python time module2m 50s
-
(Locked)
Python HTML parser module7m 17s
-
(Locked)
Text wrap module4m 23s
-
(Locked)
Python HTTP package and urllib and JSON modules6m 34s
-
(Locked)
Solution: Add Fractions with Fraction Module59s
-
-