XML : Python: parse XML with utf-8 (cyrillic) as string

I need to read xml file as a string (not to parse it). Problem is, it is all in Cyrillic, and I failed reading (or, at least, printing) the string in a good way.

my attempts:

  with open (path, "r" ) as myfile:      return myfile.read().replace('\n', '')      with open (path, "r" ) as myfile:       return unicode(myfile.read().replace('\n', ''),encoding='utf8')    

both work, and I've been able to operate on string in first case - but still cannot print it

No comments:

Post a Comment