Question: PYTHON Complete the Boldface class so that when its process method is called (with a URL as its parameter), it prints all text of the

PYTHON

Complete the Boldface class so that when its process method is called (with a URL as its parameter), it prints all text of the specified URL which is in boldface. You should use the HTMLParser class to make the coding easier.

Here is an example to illustrate how your program should work.

>>> b = Boldface() >>>

b.process('http://condor.depaul.edu/slytinen')

Steven Lytinen

Winter 2017 Schedule

Spring 2017 schedule

Research information

BELOW: THIS CODE WAS GIVEN FOR US IN ORDER TO SOLVE THE PROBLEM.

from urllib.request import urlopen from html.parser import HTMLParser from tkinter import * from random import randint

class Boldface(HTMLParser): def __init__(self): HTMLParser.__init__(self) self.bold = False # indicates when we are in a element

def handle_starttag(self, tag, attrs): pass # fill this in

def handle_data(self, data): pass # fill this in

def handle_endtag(self, tag): pass # fill this in

def process(self, url): self.feed(urlopen(url).read().decode())

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!