I can see that the values are updating but when I check that in XMl file it shows original values , How can I update original XML file with edits or create a new XML file with edits. Here is what I am doing
with open("C:/file/abcd.xml","r") as file_in:
content = file_in.read()
soup = bs(content,"xml")
loc = re.compile(r'[A-Z]+-+[0-9]+/+SM+-+[1-9]$')
for i in soup.find_all('managedOb', dist=loc):
locat=i.find('p',{'name':'modLoc'})
locat.string="U.S.A"
here is the example of my XML tags:
Original
<managedOb dist="AKAS-85409/MNOP-85409/SM-1" operation="OPEN">
<p name="modLoc">India</p>
</managedOb >
Change I am doing
<managedOb dist="AKAS-85409/MNOP-85409/SM-1" operation="OPEN">
<p name="modLoc">U.S.A</p>
</managedOb >
But I am not able to save the changes or create a new file with changes.