On Thu, 25 Jun 2015 11:39:53 -0700, kbtyo wrote: > My question can be found here: > > http://stackoverflow.com/questions/31058100/enumerate-column-headers-in- csv-that-belong-to-the-same-tag-key-in-python
I suggest you look on stack overflow for the answer. You appear to have failed to comprehend (again) the fact that the xml data is an unordered list, and are trying to assign an order to it. If the xml data was ordered, either each tag would be different, or each tag would have an attribute specifying a sequence number. If the original data is ordered, then you need to go back to the code that creates the xml and make it add the ordering information to the xml (ideally as an attribute of the tags concerned) to specify the order. You can not reliably and with any certainty of being accurate try and assign some sequence to the list of similarly named elements simply from their position in the list. You don't know if the code that creates the xml is walking the array like this: i = sizeof(arr); while (i--) addXmlElement(arr[i]); or like this: for (i = 0; i < arr.len; i++) addXmlElement(arr[i]); or even like this: while (sizeof(arr)) addXmlElement(popArrElement(arr[sizeof(arr)/2])); Granted the latter is unlikely and perverse, but still not wholly impossible. More perverse and less likely mechanisms are also available. But my point remains - that if the ordering data is not passed into the xml, then you can not magically add it when you later use the xml. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list