I am using python version 2.7.3.
test.txt:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<test>The tag <StackOverflow> is good to bring up at parties.</test>
</root>
Result:
>>> import xml.etree.ElementTree as ET
>>> e = ET.parse('test.txt')
>>> root = e.getroot()
>>> print root.find('test').text
The tag <StackOverflow> is good to bring up at parties.
As you can see, the analyzer should have changed <to <, etc.
What I would like to see:
The tag <StackOverflow> is good to bring up at parties.
Untouched, raw text. Sometimes I like it a lot. Raw.
I would like to use this text as it is for display in HTML, so I do not want the XML parser to not work with it.
Do I need to persuade every line or can there be a different way?
user155407
source
share