PyDocs

Nav

Structured Markup Processing Tools

Element.set

  • Element.set(key, value)
Set the attribute key on the element to value.
1 Example
>>> for rank in root.iter('rank'):
...     new_rank = int(rank.text) + 1
...     rank.text = str(new_rank)
...     rank.set('updated', 'yes')
...
>>> tree.write('output.xml')
from the Python docs
See Also
No see-alsos for xml.etree.ElementTree/Element.set
0 Notes
No notes for Element.set