Correct URL encoding

mattia gervaz at
Mon Mar 16 00:21:19 CET 2009

I'm using urlopen in order to download some web pages. I've always to 
replace some characters that are in the url, so I've come up with:
url.replace("|", "%7C").replace("/", "%2F").replace(" ", "+").replace
(":", "%3A")
There isn't a better way of doing this?

More information about the Python-list mailing list