I have 50 folders that contain each one an xml file. The problem is that the formatting is supposed to be like:
<data>
<items>
<item name="item1_πα"></item>
<item name="item2_πα"></item>
<item name="item3_πα"></item>
<item name="item4_πα"></item>
</items>
</data>
but is
b'<data>\n <items>51041<item name="item1_\xcf\x80\xce\xb1\xcf\x81\xce\xb1\xce\xb3\xcf\x89\xce\xb3\xce\xae"/>\n <item name="item2"/>\n <item name="item3"/>\n <item name="item4"/>\n </items>\n</data>\n\n'
can I modify them all with a loop and make them appear as they should?
something like this:
for i in os.listdir(r"C:\Users\user\Desktop\testin"): # <- here are the 50 folders
with open('bac.xml', 'r'): # open each xml
with open('bac.xml','w'): # write each xml formatted now
example.writexml(file, indent='\n', addindent=' ',encoding = 'utf-8')
Note:All the xml files in each folder have the same name.