How to URL Escape Relative URL in Python

Question:

When I go to get the following urls, there is a problem. I’m attempting to bookmark this site, but the first part of the URL does not appear after I run the code.

This is the code that I’m using to get the url from anamed’s list of job titles. This parses the href attribute from the a tag.

Asked By: amir ahmed

||

Answers:

Yes, its a relative link.

You could use something like that

base_url = "https://wuzzuf.net"
links.append(f"{base_url}{jobtitles[i].find('a').attrs['href']}")
Answered By: bitflip