ElementTree: How to return only unicode?

Torsten Bronger bronger at physik.rwth-aachen.de
Sat Mar 14 17:32:18 CET 2009


Hallöchen!

I parse an XML file with ElementTree and get the contets with
the .attrib, .text, .get etc methods of the tree's nodes.
Additionally, I use the "find" and "findtext" methods.

My problem is that if there is only ASCII, these methods return
ordinary strings instead of unicode.  So sometimes I get str,
sometimes I get unicode.  Can one change this globally so that they
only return unicode?

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
                   Jabber ID: torsten.bronger at jabber.rwth-aachen.de



More information about the Python-list mailing list