468,549 Members | 2,418 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,549 developers. It's quick & easy.

urlDecode()

Anybody can tell me what i need to import to make urlDecode() work in
python2.5 please.

import urllib
urllib.urlDecode(post) #doesn't exist
urllib.urldecode(post) #doesn't exist
urldecode(post) #doesn't exist
urlDecode(post) #doesn't exist

Mar 1 '07 #1
3 25857
import re

def htc(m):
return chr(int(m.group(1),16))

def urldecode(url):
rex=re.compile('%([0-9a-hA-H][0-9a-hA-H])',re.M)
return rex.sub(htc,url)

if __name__ == '__main__':
print urldecode('adasasdasd%20asdasdasdas')

Ok thats it enough googeling around i make one my self :)

Mar 1 '07 #2
En Wed, 28 Feb 2007 22:45:40 -0300, gert <ge**********@gmail.comescribió:
import re

def htc(m):
return chr(int(m.group(1),16))

def urldecode(url):
rex=re.compile('%([0-9a-hA-H][0-9a-hA-H])',re.M)
return rex.sub(htc,url)

if __name__ == '__main__':
print urldecode('adasasdasd%20asdasdasdas')

Ok thats it enough googeling around i make one my self :)
You reinvented urllib.unquote

--
Gabriel Genellina

Mar 1 '07 #3
On Mar 1, 1:40 pm, "Gabriel Genellina" <gagsl-...@yahoo.com.arwrote:
En Wed, 28 Feb 2007 22:45:40 -0300, gert <gert.cuyk...@gmail.comescribió:
import re
def htc(m):
return chr(int(m.group(1),16))
def urldecode(url):
rex=re.compile('%([0-9a-hA-H][0-9a-hA-H])',re.M)
return rex.sub(htc,url)
if __name__ == '__main__':
print urldecode('adasasdasd%20asdasdasdas')
Ok thats it enough googeling around i make one my self :)

You reinvented urllib.unquote
lol ok i am not going to argue about why they call it unquote
Mar 2 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Thomas Henz | last post: by
reply views Thread by Yifan | last post: by
1 post views Thread by João Santa Bárbara | last post: by
5 posts views Thread by Yifan | last post: by
4 posts views Thread by John Hoge | last post: by
6 posts views Thread by John Grandy | last post: by
10 posts views Thread by Alex | last post: by
1 post views Thread by fjm67 | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.