On Sun, Mar 15, 2009 at 4:21 PM, mattia <ger...@gmail.com> 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?
I believe you're looking for the aptly-named urlencode() function: http://docs.python.org/library/urllib.html#urllib.urlencode Cheers, Chris -- I have a blog: http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list