Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import os
  2. import xml.etree.ElementTree as et
  3.  
  4. base_path = os.path.dirname(os.path.realpath(__file__)
  5. #print(base_path)
  6.  
  7. xml_file = os.path.join(base_path, "C:\Users\huque\Desktop\test.xml")
  8.  
  9. tree = et.parse(xml_file)
  10. root = tree.getroot()
  11.  
  12. for child in root:
  13. print(child.tag)
  14.  
  15. Traceback (most recent call last):
  16. File ".test.py", line 13, in <module>
  17. tree = et.parse(xml_file) # takes xml file and saves into tree variable
  18. File "C:Python37libxmletreeElementTree.py", line 1197, in parse
  19. tree.parse(source, parser)
  20. File "C:Python37libxmletreeElementTree.py", line 598, in parse
  21. self._root = parser._parse_whole(source)
  22. xml.etree.ElementTree.ParseError: mismatched tag: line 33, column 28
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement