Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apply relative URL to an absolute URL

Tags:

python

url

I have an absolute URL, and the URL that a link on that page points to. Is there a builtin function to apply a relative URL to an absolute URL?

Ie. "http://example.com/some/url", "/some/url/I/want/to/go/to" => "http://example.com/some/url/I/want/to/go/to"

like image 477
Jeffrey Aylesworth Avatar asked Mar 28 '10 01:03

Jeffrey Aylesworth


1 Answers

urlparse.urljoin() does just this.

like image 111
Ignacio Vazquez-Abrams Avatar answered Sep 30 '22 03:09

Ignacio Vazquez-Abrams