I looked on the internet but I couldn't find a working answer to my question. I need to replace an XML file attribute value if it is size="10.439"
to size="10.238"
. Basically, I need to change that number in the whole XML file. So the code is:
import lxml.etree as etree
import re
parser = etree.XMLParser(remove_blank_text=True)
tree = etree.parse('fe3.xml', parser)
re.sub(r'size="10.439"','size="10.238"', tree)
But it won't work, what do I have to do to make it work?
If it helps, the size attribute is in the tag text
of the XML. Like this:
<pages>
<page>
<textbox>
<text size = "10.439"> hello
</text>
</textbox>
</page>
</pages>