Skip to content

Instantly share code, notes, and snippets.

@yolabingo
Created September 1, 2022 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yolabingo/d5da07954f6085c925acee7d47ba3379 to your computer and use it in GitHub Desktop.
Save yolabingo/d5da07954f6085c925acee7d47ba3379 to your computer and use it in GitHub Desktop.
python - join url fragments
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