write xml to txt encoding

William Johnston williamj at tenbase2.com
Thu Jul 29 08:12:30 EDT 2010


 

Hello,

 

I have a Python app that parses XML files and then writes to text files.

 

However, the output text file is "sometimes" encoded in some Asian language.

 

Here is my code:

 

encoding = "iso-8859-1"

clean_sent = nltk.clean_html(sent.text)

clean_sent = clean_sent.encode(encoding, "ignore");

 

I also tried "UTF-8" encoding, but received the same results.

 

Any suggestions?

 

Thanks.

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100729/e0324128/attachment.html>


More information about the Python-list mailing list