Created
February 17, 2014 03:12
-
-
Save Zuckonit/9044051 to your computer and use it in GitHub Desktop.
unescape html to python string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
import sys | |
def cleanupString(string): | |
string = urllib2.unquote(string).decode('utf8') | |
return HTMLParser.HTMLParser().unescape(string).encode(sys.getfilesystemencoding()) |
Very helpful, however you need to import HTMLParser
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, this was really useful! :)