>From: Lee Jones
>Subject: [Tutor] urlencode
>Hello,
>I am trying to urlencode a string.  In python the only thing I can see
is the urllib.urlencode().  But this takes a dictionary, and returns
>"key=value", which is not what I want.  I only want to url-encode a
string.  Does any one know how to do this in python


Are you looking for urllib.quote() ?
 
>>> import urllib
>>> url = urllib.quote('http://puggy.symonds.net/~senthil')
>>> print url
http%3A//puggy.symonds.net/%7Esenthil
>>> 
 
 
-- 
Senthil

 

        

 
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to