Skip to content Skip to sidebar Skip to footer

Lxml Preserves Attributes Order?

I was writing my aplication using minidom but minidom does not preserve attribute order(sorts alphabetically), so I decided to do it using lxml. However in the following lines of c

Solution 1:

Dictionaries in Python are unordered. Keyword arguments are passed to functions by a dictionary traditionally named **kwargs, and so the order is lost. The function can't possibly know what order the arguments to ET.element came in.

As stated in this question, there isn't really any way to get this done. XML doesn't care about attribute order, so there isn't really any good reason to do it.

Post a Comment for "Lxml Preserves Attributes Order?"