I have a xml tree and I would like to replace the sub elements in the xml structure. This is actual xml tree read from the file
xml_data = ET.parse('file1.xml')
<?xml version='1.0' encoding='UTF-8'?> <call method="xxxx" callerName="xxx"> <credentials login="" password=""/> <filters> <accounts> <account code="" ass="" can=""/> </accounts> </filters> </call> I'm expecting this format from looping the list
a = [1,23453, 3543,4354,3455, 6345] <?xml version='1.0' encoding='UTF-8'?> <call method="xxxx" callerName="xxx"> <credentials login="" password=""/> <filters> <accounts> <account code="1" ass="34" can="yes"/> <account code="23453" ass="34" can="yes"/> <account code="3543" ass="34" can="yes"/> <account code="4354" ass="34" can="yes"/> <account code="3455" ass="34" can="yes"/> <account code="6345" ass="34" can="yes"/> </accounts> </filters> </call> New to xml-parsing. Any help would be appreciated. Thanks in advance
https://stackoverflow.com/questions/67260336/how-to-replace-xml-element-from-looping-list-on-python April 26, 2021 at 11:04AM
没有评论:
发表评论