I am writing something to "clear" the URL. In this case, all I'm trying to do is return the fake schema, since urlopen would not work without it. However, if I test this with www.python.org , it will return http:///www.python.org . Does anyone know why an extra /, and is there a way to get this back without it?
def FixScheme(website): from urlparse import urlparse, urlunparse scheme, netloc, path, params, query, fragment = urlparse(website) if scheme == '': return urlunparse(('http', netloc, path, params, query, fragment)) else: return website
python urlparse
Ben
source share