[Tutor] urlencode

Senthil_OR at Dell.com Senthil_OR at Dell.com
Tue Jun 5 12:18:26 CEST 2007


>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

 

	

 


More information about the Tutor mailing list