import urlparse
url = urlparse.urlparse("http://www.python.org/doc/FAQ.html")
print url
print urlparse.urlunparse(url)
运行结果:
ParseResult(scheme='http', netloc='www.python.org', path='/doc/FAQ.html', params='', query='', fragment='')
http://www.python.org/doc/FAQ.html