xml - save a tree as a key in a dictionary, Python 3.4 -


I have hundreds of XML files I have been working to compare 2 XML trees and if they are the same Each XML tree has unique ID numbers which has been ignored in comparison.

Now I can iterate and compare all XML files. But I want to save the trees in the data structure like dictionaries but the dragon does not allow me to save the tree as a key and its id as a value. Is there a way in the form of the dictionary key of a tree? If not, what kind of data structure can be used for this?

Example: Enter image details Please note that tree 1 = tree 2 but! = Tree 3 (Ignoring the ID) Therefore, I should be like my DIC or any data structure: </ p> <pre> <code> dic = {tree 1: [I1.i1.p1.m1, I1.i1. P1.m2], tree 3: [I1.i1.p1.m3]} </ code> </ pre> <p> thanks </ p> </ div> <p> <div class =

The dictionary is Hashmap, which means that the keys should be harmful, which usually indicates that the item is washed (Due to these lists are not valid keys, but Tuples are).

What you need is a function that generates this hash to generate a hash on the data structure like tree for your objects. There is a trivial problem. But, since you can already create equality, you should have an idea about some features that make your data recognizable.

You always have the feature vector

  • Depth of paste
  • Number of children
  • hash above already available serialization
  • < / Div>

    Comments

    Popular posts from this blog

    apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

    c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

    c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -