Skip to content
Advertisement

How to convert list data to xml using python

I have been trying to convert list data to xml file.

But getting below error : ValueError: Invalid tag name '0'

This is my header : 'Name,Job Description,Course'

Code:

JavaScript

Advertisement

Answer

The df you created is improper. There are two scenarios.

  1. If you took name, job description, course as single header. You will fail at the point of saving df to xml.
  2. In order to save df as xml there is a format that need to be followed.

Below solution works. Hope this is what you are trying to achieve.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement