Correct URL encoding
Graham Breed
x31eq at cnntp.org
Sun Mar 15 19:38:32 EDT 2009
mattia wrote:
> 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?
Yeah, shame there's no function -- called "urlencode" say --
that does it all for you.
Graham
More information about the Python-list
mailing list