from xml.dom import minidom
dict[1] = "country"
xmldoc = minidom.parse('TestStep.xml')
itemlist = xmldoc.getElementsByTagName('TestStepBody')
print len(itemlist)
print itemlist[0].attributes['Author'].value
for s in itemlist :
print s.attributes['Author'].value

dict[1] value will be changing dynamically, So i need to dynamically change the attribute value of the Author in python. I this possible? if so Can any one help me in this.

I don't really use the xml module, and it would really help if you could format your code. But this is what I found:

s = '<foo name="test"><foobar name="original"></foobar></foo>'
d = minidom.parseString(s)
elems = d.getElementsByTagName('foobar')
elems[0].setAttribute('name', 'changed!')
print(d.toprettyxml(indent='    '))


<?xml version="1.0" ?>
<foo name="test">
    <foobar name="changed!"/>

The element is changed. Instead of print, just write it to a file. Hint:

with open('', 'w') as f:
    d.writexml(f, addindent='    ', newl='\n')


with open('', 'w') as f:
    f.write(d.toprettyxml(indent='    '))