This compare function works for me:
def elements_equal(e1, e2):
if e1.tag != e2.tag: return False
if e1.text != e2.text: return False
if e1.tail != e2.tail: return False
if e1.attrib != e2.attrib: return False
if len(e1) != len(e2): return False
return all(elements_equal(c1, c2) for c1, c2 in zip(e1, e2))
Related Contents:
- Switch between two frames in tkinter
- Best way to convert string to bytes in Python 3?
- How to replace NaNs by preceding or next values in pandas DataFrame?
- What do ellipsis […] mean in a list?
- What does a b prefix before a python string mean?
- Type hinting a collection of a specified type
- How do chained assignments work?
- access ElementTree node parent node
- Moving Average Pandas
- ‘str’ object has no attribute ‘decode’. Python 3 error?
- Invalid character in identifier
- Type hint for a function that returns only a specific set of values
- How to uninstall a package installed with pip install –user
- How do I bind the enter key to a function in tkinter?
- How to get tkinter canvas to dynamically resize to window width?
- How can I get 2.x-like sorting behaviour in Python 3.x?
- What’s the best way to store a phone number in Django models?
- “Permission Denied” trying to run Python on Windows 10
- How to run pip from different versions of python using the python command?
- What is __pycache__?
- How do I encrypt and decrypt a string in python?
- How to upload a file to Google Cloud Storage on Python 3?
- How to fix ” DeprecationWarning: invalid escape sequence” in Python?
- python 3 open() default encoding
- scipy curve_fit doesn’t like math module
- Nested f-strings
- Set up Python simpleHTTPserver on Windows [duplicate]
- builtins.TypeError: must be str, not bytes
- PyEval_InitThreads in Python 3: How/when to call it? (the saga continues ad nauseam)
- SSL: CERTIFICATE_VERIFY_FAILED with Python3
- Sphinx cannot find my python files. Says ‘no module named …’
- Python 3.1.1 string to hex
- Calling a Python function with *args,**kwargs and optional / default arguments
- Accessing dictionary items by position in Python 3.6+ efficiently
- Identifier normalization: Why is the micro sign converted into the Greek letter mu?
- Adding a data file in Pyinstaller using the onefile option
- Should I use encoding declaration in Python 3?
- Python decorator? – can someone please explain this? [duplicate]
- Sorting by absolute value without changing to absolute value
- Class vs. Type in Python
- How to get Windows short file name in python?
- import httplib ImportError: No module named httplib
- Is cube root integer?
- Sending a password over SSH or SCP with subprocess.Popen
- PyQt5 QImage from Numpy Array
- Issue with regex backreference in Python
- How to combine Celery with asyncio?
- Can’t import annotations from __future__
- Is i = i + n truly the same as i += n? [duplicate]
- Emitting namespace specifications with ElementTree in Python