I have a dict that's feed with url response. Like:
>>> d
{
0: {'data': u'<p>found "\u62c9\u67cf \u591a\u516c \u56ed"</p>'}
1: {'data': u'<p>some other data</p>'}
...
}
While using xml.etree.ElementTree
function on this data values (d[0]['data']
) I get the most famous error message:
UnicodeEncodeError: 'ascii' codec can't encode characters...
What should I do to this Unicode string to make it suitable for ElementTree parser?
PS. Please don't send me links with Unicode & Python explanation. I read it all already unfortunately, and can't make use of it, as hopefully others can.
ElementTree.tostring
. Can you please tryElementTree.tostring(p, method='text')
and tell why it doesn't work? Thanks – Gastroenterostomy