I need to modify the parameters of a function in xml file with ElementTree while the elements have similar names. In this example I want to change only the number 2 and keep the others. Is it possible?
<Model>
<Function>
<param>x</param>
<param>type</param>
<param>2</param>
<param>5</param>
</Function>
</Model>
param-element based on the value2(see here). alternatively you could also select the third occurrence ofparam(see here). once you have the element, useElementTrees capabilities to change the text (see here).