• + 0 comments
    class MyHTMLParser(HTMLParser):
        def handle_comment(self, data):
            if '\n' in data:
                print(">>> Multi-line Comment")
            else:
                print(">>> Single-line Comment")
            print(data)
        def handle_data(self, data):
            if x := data.rstrip():
                print(">>> Data")
                print(x)