Created
September 1, 2022 01:52
-
-
Save yolabingo/d5da07954f6085c925acee7d47ba3379 to your computer and use it in GitHub Desktop.
python - join url fragments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def urljoin(*args): | |
""" Joins given arguments into an url, removing extra slashes """ | |
return "/".join(map(lambda x: x.rstrip('/') if x.startswith('//') else x.strip('/'), args)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment