Decoding LATIN1 character to ASCII in python 2.7 -
Decoding LATIN1 character to ASCII in python 2.7 -
i getting string website, not sure on encoding. first character in string letter "Î".
i utilize code:
import lxml.html lh import urllib2 import unicodedata url = 'http://www.example.com/' doc = lh.parse(urllib2.urlopen(url)) stoc = doc.xpath('xpath.example') print unicodedata.normalize('nfkd', stoc[0]).encode('ascii', 'ignore')
the problem don't "i" out of "Î", "a". utilize .replace('a','i'), improve method ?
thank you.
python-2.7 character-encoding
Comments
Post a Comment