Answers for "URL to origin python"

0

URL to origin python

from urllib.parse import urlparse
# from urlparse import urlparse  # Python 2
parsed_uri = urlparse('http://stackoverflow.com/questions/1234567/blah-blah-blah-blah' )
result = '{uri.scheme}://{uri.netloc}/'.format(uri=parsed_uri)
print(result)

# gives
'http://stackoverflow.com/'
Posted by: Guest on April-29-2022

Python Answers by Framework

Browse Popular Code Answers by Language