423,818 Members | 2,250 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,818 IT Pros & Developers. It's quick & easy.

urlDecode()

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.