You are viewing a single comment's thread. Return to all comments →
from html.parser import HTMLParser as htp class MHP(htp): def handle_starttag(self, tag, attrs): print("Start :", tag) if attrs: print("\n".join("-> "+" > ".join(str(i) for i in c) for c in attrs)) def handle_endtag(self, tag): print("End :", tag) def handle_startendtag(self, tag, attrs): print("Empty :", tag) if attrs: print("\n".join("-> "+" > ".join(str(i) for i in c) for c in attrs)) my_htp = MHP() tags = "" for _ in range(int(input())): tags += input() else: my_htp.feed(tags)
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 →