Hello all,
Not sure if this question has been answered already.
I have some xml Element variable as below:
Next I want to change the values of these corresponding elements like below:
Now instead of setting setting the values manually for each element, I wanted to do a for loop for a range (10,100). But I am not sure how to update the "child" element dynamically.
I tried following:
which surely gave me error:
Kindly help.
Not sure if this question has been answered already.
I have some xml Element variable as below:
Code:
child19 = core_elem_dcache.find('stat[@name="read_accesses"]')
child20 = core_elem_dcache.find('stat[@name="write_accesses"]')
child21 = core_elem_dcache.find('stat[@name="read_misses"]')
child22 = core_elem_dcache.find('stat[@name="write_misses"]'
Code:
child20.set('value', str(params[19]))
child21.set('value', str(params[20]))
child22.set('value', str(params[21])) ######params is a list already read before from a text file
I tried following:
Code:
for x in range(13,23):
child{x}.set('value',str(params[x-1]))
Code:
File "abc.py", line 99
child{x}.set('value',str(params[x-1]))
^
SyntaxError: invalid syntax