Fastest way to convert a URI into a scheme relative URI (in python)
<p>In python, whats the <em>fastest</em> way to convert a url of the type <code>scheme://netloc/path;parameters?query#fragment</code> into a "scheme relative" or "protocol relative" URI?</p>

<hr>

<p>Currently, I'm doing a version of <a href="http://stackoverflow.com/a/21687728/4936905">this</a>, but was thinking there might be a more concise/faster way to accomplish this. The input always has <code>https://</code> or <code>http://</code> appended to it.</p>

<pre><code>from urlparse import urlparse
o = urlparse('http://www.cwi.nl:80/%7Eguido/Python.html')

print o.scheme
print o.netloc
print o.path
</code></pre>

<p>is how i would probably do it ...</p>

python