You are viewing a single comment's thread. Return to all comments →
from html.parser import HTMLParser class myHTMLParser(HTMLParser): def __init__(self): super().__init__() N = int(input()) for _ in range(N): html_text = input() self.feed(html_text) def handle_starttag(self, tag, attrs): print("Start :", tag) for name, value in attrs: print("->", name, ">", value) def handle_endtag(self, tag): print("End :", tag) def handle_startendtag(self, tag, attrs): print("Empty :", tag) for name, value in attrs: print("->", name, ">", value) parser = myHTMLParser()
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 →