How can I avoid dicttoxml producing underscore in keys

145 Views Asked by At

I am using dicttoxml to write a dictionary structure to an xml file.

For example

from dicttoxml import dicttoxml
myDict= {"This is a key": "some value"}
myRecord= dicttoxml(myDict, attr_type=False, root=False)

When checking the output file 'This is a key' and the value got converted into

<This_is_a_key>some value</This_is_a_key>

Is there a way to avoid the conversion to underscore so instead I get

<This is a key>some value</This is a key>

0

There are 0 best solutions below