Make a relative url path from an absolute path to another one

Gilles Lenfant glenfant at NOSPAM.bigfoot.com
Mon Oct 27 09:18:38 EST 2003


Hi,

I'm sometimes brain dead for a simple problem like this one :

Given an origin absolute URL and a destination absolute URL, I want to make
a relative path from the origin to the destination.

e.g

origin = http://www.stuff.com/x/y/foo.html
destination = http://www.stuff.com/x/bar.html

-> ../bar.html

origin = http://www.stuff.com/x/bar.html
destination = http://www.stuff.com/x/y/foo.html

-> y/foo.html

Many thanks for any hint.

--
Gilles





More information about the Python-list mailing list