We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
HTML Parser - Part 1
HTML Parser - Part 1
Sort by
recency
|
171 Discussions
|
Please Login in order to post a comment
In the challenge explantion there is a wrong code; in the example they mentioned the import statement as: from HTMLParser import HTMLParser
But it should be: from html.parser import HTMLParser
Please HackerRank team update it.
from html.parser import HTMLParser
class MyHTMLParser(HTMLParser): def handle_starttag(self, tag, attrs): print("Start :", tag) for attr in attrs: print("->", attr[0], ">", attr[1])
parser = MyHTMLParser()
for i in range(int(input())): parser.feed(input())