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(tag) self._print_attrs(attrs) @staticmethod def _print_attrs(attrs): for attr, value in attrs: print(f"-> {attr} > {value}") lines = [] n = int(input()) for _ in range(n): line = input() lines.append(line) parser = MyHTMLParser() parser.feed(''.join(lines))
Seems like cookies are disabled on this browser, please enable them to open this website
Detect HTML Tags, Attributes and Attribute Values
You are viewing a single comment's thread. Return to all comments →