Creating a simple XML file using python - Stack Overflow
https://stackoverflow.com/questions/3605680/creating-a-simple-xml-file-using-python
Aug 31, 2010 · @YonatanSimson I don't know how to add that exact string, since ElementTree seems to only obey xml_declaration=True if you specify an encoding... but, to get equivalent behaviour, call tree.write() like this: tree.write("filename.xml", xml_declaration=True, encoding='utf-8') You can use any encoding as long as you explicitly specify one. (ascii will …
DA: 75 PA: 97 MOZ Rank: 12