Answered step by step
Verified Expert Solution
Question
1 Approved Answer
OUTPUT: Template given: (Python) https://drive.google.com/file/d/1SmUUR0dbztAzs1nUXQphhoaAm37wwCXK/view?usp=sharing 2. Write class ImgParser that is a subclass of the HTMLParser class. It will find and collect the contents of
OUTPUT:
Template given: (Python)
https://drive.google.com/file/d/1SmUUR0dbztAzs1nUXQphhoaAm37wwCXK/view?usp=sharing
2. Write class ImgParser that is a subclass of the HTMLParser class. It will find and collect the contents of all the images in an HTML file fed to it. The parser works by identifying when a img tag and extracting the href attribute. To implement this parser, you wil need to override the following methods of the HTMLParser class: init to the empty list. handle_starttag: If the tag that resulted in this method being called is an img tag, from here you can get its attributes to see the value of href. a- : The constructor calls the parent class constructor and sets an internal list b. c. getlmages0: The function returns the list of images gathered by the parserStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started