How to unencode a string

Stephen Fairchild somebody at somewhere.com
Thu Aug 27 18:16:14 EDT 2009


jakecjacobson wrote:

> This seems like a real simple newbie question but how can a person
> unencode a string?  In Perl I use something like: "$part=~ s/\%([A-Fa-
> f0-9]{2})/pack('C', hex($1))/seg;"
> 
> If I have a string like Word1%20Word2%20Word3 I want to get Word1
> Word2 Word3.  Would also like to handle special characters like '",(){}
> [] etc/

import urllib
print urllib.unquote("Word1%20Word2%20Word3")
-- 
Stephen Fairchild



More information about the Python-list mailing list