[Tutor] ascii encoding

Chad Crabtree flaxeater at yahoo.com
Tue Jan 25 00:46:10 CET 2005


I got this from spyce
http://spyce.sourceforge.net

_url_ch = re.compile(r'[^A-Za-z0-9_.!~*()-]') # RFC 2396 section 2.3
def url_encode(o, **kwargs):
  '''Return URL-encoded string.'''
  return _url_ch.sub(lambda match: "%%%02X" % ord(match.group(0)),
str(o))

It was just the first thing I found in google "python url encode"

Good Luck

Luis N wrote:

>How would I best turn this string:
>
>
>
>'2005-01-24 00:00:00.0'
>
>
>
>into this string:
>
>
>
>'2005%2D01%2D24%2000%3A00%3A00%2E0'
>
>
>
>In order to call a URL.
>
>
>
>I've hunted through the standard library, but nothing seemed to jump
out.
>
>
>
>Thank You.
>
>_______________________________________________
>
>Tutor maillist  -  Tutor at python.org
>
>http://mail.python.org/mailman/listinfo/tutor
>
>
>
>  
>



		
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 



More information about the Tutor mailing list