title: How to write the output of this code to HTML file?
body: <pre><code>from HTMLParser import HTMLParser
  
  from urllib import urlopen
  
  class Spider(HTMLParser):
  
          def __init__(self, url):
                  HTMLParser.__init__(self)
                  req = urlopen(url)
                  self.feed(req.read())
  
          def handle_starttag(self, tag, attrs):
                  if tag == 'a' and attrs:
                          print "Found link =&gt; %s" % attrs[0][1]
  
  Spider('http://stackoverflow.com/questions/tagged/python')
  </code></pre>