Converting relative URLs to absolute

Brian Quinlan brian at sweetapp.com
Wed Mar 13 01:14:04 EST 2002


> Does anyone have any code that, given that absolute URL of a web page,
can
> convert all the relative URLs on that page to their absolute
equivalent?

To create the URLs, look at urljoin from the standard library. See:
http://www.python.org/doc/current/lib/module-urlparse.html

I'm less certain of the correct approach to doing the transforming of
the web page. I'd probably just use a regular expression.

Cheers,
Brian  





More information about the Python-list mailing list