我正在尝试解析包含一些非ASCII字符的XML文件,
代码如下:
from lxml import etree
from lxml import objectify
content = u'<?xml version="1.0" encoding="utf-8"?><div>Order date : 05/08/2013 12:24:28</div>'
mail.replace('\xa0',' ')
xml = etree.fromstring(mail)
但是它在“content = ...”这一行给我显示错误。syntaxError: Non-ASCII character '\xc2' in file /home/projects/ztest/responce.py on line 3,
but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
终端上运行正常,但在Eclipse IDE上运行会出错。
不知道该如何解决。