URL Character Decoding

Paul McGuire ptmcg at austin.rr._bogus_.com
Sun Jan 29 23:05:50 EST 2006


"Kirk McDonald" <mooquack at suad.org> wrote in message
news:43dd86ad at nntp0.pdx.net...
> If you have a link such as, e.g.:
>
> <a href="index.py?title=Main Menu">Main menu!</a>
>
> The space will be translated to the character code '%20' when you later
> retrieve the GET data.
>
> I guess what I'm asking is: Is there a library function (in Python or
> mod_python) that knows how to do this? Or, failing that, is there a
> different regex I could use to get rid of the substitution function?
>
> -Kirk McDonald


>>> import urllib
>>> urllib.quote("index.py?title=Main Menu")
'index.py%3Ftitle%3DMain%20Menu'
>>> urllib.unquote("index.py%3Ftitle%3DMain%20Menu")
'index.py?title=Main Menu'





More information about the Python-list mailing list