How i follow tree folders from url

Chris Rebert clp2 at rebertia.com
Sun Aug 30 10:39:19 CEST 2009


On Sun, Aug 30, 2009 at 1:20 AM,
catalinfest at gmail.com<catalinfest at gmail.com> wrote:
> Hello !
>
> I wanna use python to follow the tree folders from one url.
> Example :
> If url is "www.site.com/first/ and "
> "first" is first folder with next subfolders "01","02","03"
> The result of script should be :
>
> www.site.com/first/01/
> www.site.com/first/02/
> www.site.com/first/03/
> Maybe urllib has some functions , but i don't know them.

HTTP has no equivalent to "ls". You have to either know the format the
of URLs yourself or spider the links on a given page.
To generate the URLs if you know the scheme, use range() and str.zfill().

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list