Converting relative URLs to absolute

Robin Becker robin at jessikat.fsnet.co.uk
Mon Mar 18 12:14:07 EST 2002


In article <mailman.1016464710.8627.python-list at python.org>,
brueckd at tbye.com writes
>On 18 Mar 2002, Paul Boddie wrote:
>
>teresting candidates exist.
>
>But URL split and join functions already exist in the urlparse module
>(urlparse, *not* urllib). See urlparse's urlparse, urlunparse, and urljoin
>functions - what don't they do that you need? They certainly handle the
>make-relative-URLs-absolute problem.
>
>-Dave
>
>
well one thing I might need is a local file URL and on a win32 system.
When I try and join up 

c:/a/b/c/x.html with an empty host I get something that can't be used

>>> urlparse.urlunparse(('file','','c:/a/b/c/x.html','','',''))
'file:c:/a/b/c/x.html'
>>> 

normally I would expect to use something like

file:///c:/a/b/c/x.html

but it seems that parse and unparse don't commute on these.
-- 
Robin Becker



More information about the Python-list mailing list