Decode html, or is it unicode, how?

G

Guest

Hi All,
I've done a bunch of searching in google and in python's help, but,
I haven't found any function to decode a string like:
Refresh! (ihenvyr)
In to plain english.
I'd also looked for the urldecode function in urllib, but that had been
deprecated.
If anyone here can give me a hand, I'd aprishiate it; it's probably very
simple, but...

Thx,

----------
Brandon McGinty
Feel free to contact me for technical support, or just to chat; I always
have time to talk and help, and an open ear.
Email:[email protected]
Skype:brandon.mcginty
Msn:[email protected]
Aim:brandonmcginty (Not currently available.)
Cell:(480)-202-5790 (Weekends and nights only, please.)
"Kindness is a language that the deaf can hear and the blind can see."
Mark Twain
 
B

Ben C

Hi All,
I've done a bunch of searching in google and in python's help, but,
I haven't found any function to decode a string like:
Refresh! (ihenvyr)
In to plain english.
[...]

I needed to do that the other day, and did it like this:

def decode(line):
pat = re.compile(r'&#(\d+);')
def sub(mo):
return unichr(int(mo.group(1)))
return pat.sub(sub, unicode(line))

there may well be a better way though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top