The trick here is in line 5, and lines 19, 20, 21, 22. The library codecs must
be imported to encode the XML file. The lines 19, 20, 21, 22 perform the task
of writing the XML content into a file. It's pretty simple and easy. This again
shows the power and beauty of Python.
In final post , we will show how to read a XML file and parse the content.