You should be able to do it with urlparse
(docs: python2, python3):
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/'
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…