Parsing the HTML of a Web Page : HTML Parser : Network PYTHON examples


PYTHON examples » Network » HTML Parser »

 

Parsing the HTML of a Web Page


 

import htmllib, urllib, formatter, sys

def parse(url, formatter):
    f = urllib.urlopen(url)
    data = f.read()
    f.close()
    p = htmllib.HTMLParser(formatter)
    p.feed(data)
    p.close()

fmt = formatter.AbstractFormatter(formatter.DumbWriter(sys.stdout))
parse("index.htm", fmt)

   
  



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Network
» HTML Parser