Here's an example of how to save only one value from a list in an XML file using Python's built-in xml.etree.ElementTree module:
main.py446 chars18 lines
In this example, the value 'banana' at index 1 of the my_list list is saved as the text content of an <item> element in an XML file named my_file.xml. If you want to save a different value from the list, just change the value of the index_to_save variable.
gistlibby LogSnag