[Tutor] Re: Listing web contents

Guido van Rossum guido@CNRI.Reston.VA.US
Sat, 27 Mar 1999 08:11:42 -0500


> Hi - Is there any way of listing the directory contents of a URL address?
> Something like
> 
> dir = urllib.urlopen(url)
> os.listdir(dir)

I'm assuming the URL points to an HTML document, and what you really
want is a listing of URLs that the given URL refers to.

In this case, you can cook something up using Python's HTML parsing
library module (htmllib).

I'm guessing that what you area really looking for is writing an
automated tool that browses a tree of related pages on the web.
In this case, please have a look at webchecker in the Python source
distribution, Tools/webchecker/.

PS.  To the tutors.  I see no significant difference between the tutor
list and the help list.  Perhaps tutor should be merged back into
help?

--Guido van Rossum (home page: http://www.python.org/~guido/)