Re: ignoring chinese characters parsing xml file
- From: Stefan Behnel <stefan.behnel-n05pAM@xxxxxx>
- Date: Tue, 23 Oct 2007 08:38:17 +0200
Fabian López wrote:
Thanks Mark, the code is like this. The attrib name is the problem:
from lxml import etree
context = etree.iterparse("file.xml")
for action, elem in context:
if elem.tag == "weblog":
print action, elem.tag , elem.attrib["name"],elem.attrib["url"],
The problem is the print statement. Looks like your terminal encoding (that
Python needs to encode the unicode string to) can't handle these unicode
characters.
Stefan
.
- Follow-Ups:
- Re: ignoring chinese characters parsing xml file
- From: limodou
- Re: ignoring chinese characters parsing xml file
- References:
- Re: ignoring chinese characters parsing xml file
- From: Marc 'BlackJack' Rintsch
- Re: ignoring chinese characters parsing xml file
- From: Fabian López
- Re: ignoring chinese characters parsing xml file
- Prev by Date: Re: Monitoring external processes
- Next by Date: Re: Iteration for Factorials
- Previous by thread: Re: ignoring chinese characters parsing xml file
- Next by thread: Re: ignoring chinese characters parsing xml file
- Index(es):