How to unencode a string

Piet van Oostrum piet at cs.uu.nl
Thu Aug 27 18:51:55 EDT 2009


>>>>> jakecjacobson <jakecjacobson at gmail.com> (j) wrote:

>j> This seems like a real simple newbie question but how can a person
>j> unencode a string?  In Perl I use something like: "$part=~ s/\%([A-Fa-
>j> f0-9]{2})/pack('C', hex($1))/seg;"

>j> If I have a string like Word1%20Word2%20Word3 I want to get Word1
>j> Word2 Word3.  

urllib.unquote(string)

>j> Would also like to handle special characters like '",(){}
>j> [] etc/

What would you like to do with them? Or do you mean to replace %27 by ' etc?
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list