How to exctract title of links

raver2046 raver2046 at gmail.com
Tue Apr 26 08:20:07 EDT 2005


here i have a link  <a href="http://raver2046.ath.cx/CV/">cv network 
admin</a>

how to extract  "cv network admin"


here is the code i have find to exctract link but not title of link

----------------------------
import htmllib, formatter, urllib
class x(htmllib.HTMLParser):
    def dump(self, tag, attrs):
        #print tag,
        for a, v in attrs:
            if a in ['a', 'src', 'href']:
                print v,

        print
    #def do_img(self, attrs):
    #    self.dump('img', attrs)
    def start_a(self, attrs):
        self.dump('a', attrs)
    #def start_form(self, attrs):
    #    self.dump('form', attrs)

y = x(formatter.NullFormatter())
y.feed(urllib.urlopen('http://www.aquabase.org/fish/dump.php3').read())
y.close()


----------------------------

http://raver2046.ath.cx/CV/cv_fr.html 





More information about the Python-list mailing list