Question: from html import unescape from urllib.request import * from urllib.error import * from html.parser import * from urllib.parse import urljoin class Headlines(HTMLParser): def __init__(self, url):

from html import unescape from urllib.request import * from urllib.error import * from html.parser import * from urllib.parse import urljoin

class Headlines(HTMLParser):

def __init__(self, url): HTMLParser.__init__(self) # some instance variables? def handle_starttag(self, tag, attrs): pass # if the tag is h1, h2, or h3 then mark this # in some way so that handle_data knows to print # the headline def handle_data(self, data): pass

def handle_endtag(self, tag): pass # mark in some way that the end of a headline element has # been reached def headlines(self, level=3): # for full credit, the level specifies what kind of headline # elements should be printed (h1, h2, and/or h3) pass

# example call to this program # >>> h = Headlines('http://www.nytimes.com') # h.headlines()

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!