i’m iterating xml node values, which i get from xpath query. And i need to assign a reference to some node value.
Here what i want to to:
from lxml import etree
doc = etree.fromstring(some_xml)
nodes = doc.xpath('some_query')
for node in nodes:
if node.text == 'smth':
#there i need to assign reference
reference = node.text
#after iterating i need to that change the node value
reference = 'hello world'
is there a way to do it in python?
thanks!
store a reference to the actual node instead: