You are viewing a single comment's thread. Return to all comments →
from html.parser import HTMLParser class MyHTMLParser(HTMLParser): def handle_starttag(self, tag, attrs): print("Start :", tag) for x,y in attrs: print("-> %s > %s" % (x,y)) def handle_endtag(self, tag): print("End :", tag) def handle_startendtag(self, tag, attrs): print("Empty :", tag) for x,y in attrs: print("-> %s > %s" % (x,y)) parser = MyHTMLParser() html_data = '' N = int(input()) for i in range(N): html_data = html_data + input() parser.feed(html_data)
Seems like cookies are disabled on this browser, please enable them to open this website
HTML Parser - Part 1
You are viewing a single comment's thread. Return to all comments →