Snippets Collections
from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):
    def handle_starttag(self, tag, attrs):
        print("Encountered a start tag:", tag)
    def handle_endtag(self, tag):
        print("Encountered an end tag :", tag)
    def handle_data(self, data):
        print("Encountered some data  :", data)

parser = MyHTMLParser()
parser.feed('<html><head><title>Test</title></head>'
            '<body><h1>Parse me!</h1></body></html>')
           
bookmark
dashboard

Thu Jan 02 2020 19:00:00 GMT+0000 (UTC) https://docs.python.org/3.4/library/html.parser.html

#html #python #xhtml

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension