When parsing an xml file into a Python ElementTree the attributes' order is mixed up because Python stores the attributes in a dictionary.
How can I change the order of the attributes in the dictionary?
XML does not define any ordering of attributes of a node. So the behavior is fine.
If you make assumptions about the ordering of attributes then your assumptions are wrong.
There is no ordering and you must not expect any kind of attribute ordering. So your question is invalid.
How to order xml element attributes in Python?