Parsing an HTML a tag

George buffer_88 at
Sun Sep 25 02:16:46 CEST 2005

I'm very new to python and I have tried to read the tutorials but I am
unable to understand exactly how I must do this problem.

Specifically, the showIPnums function takes a URL as input, calls the
read_page(url) function to obtain the entire page for that URL, and
then lists, in sorted order, the IP addresses implied in the "<A
HREF=· · ·>" tags within that page.

Module to print IP addresses of tags in web file containing HTML

>>> showIPnums('')
['', '', '']

>>> showIPnums('')
['', '', '', '',
'', '', '',
'', '', '']


def read_page(url):
 import formatter
 import htmllib
 import urllib

 htmlp = htmllib.HTMLParser(formatter.NullFormatter())

def showIPnums(URL):

if __name__ == '__main__':
 import doctest, sys

More information about the Python-list mailing list