Hi everybody.
What is the usage of urljoin
?
An example:
>>> from urlparse import urljoin
>>> url = urljoin('http://python.org/','about.html')
>>> url
'http://python.org/about.html'
I think the answer is that when we take a link from here 'http://www.python.org/
for example , it looks like this <a href="/about/>about</a>
.
So if i take the href part which is /about/
here and use urljoin
to join this string (of course with .html
) to the main url which is 'http://python.org/'
here. Correct?!
Of course i should delete those /
and /
from /about/
first.