如何解决python 3.6.6中的解析错误

问题描述 投票:0回答:1

当我运行给定的代码时

import requests
import xml.etree.ElementTree as ET
u1=input("Enter URL of the first source :")
resp=requests.get(u1)
with open ('1.xml','wb') as f1:
      f1.write(resp.content)
tree = ET.parse('1.xml')
root = tree.getroot()

出现以下错误:

Traceback (most recent call last):

  File "pro.py", line 18, in <module>

    tree = ET.parse('1.xml')

  File "/usr/lib/python3.6/xml/etree/ElementTree.py", line 1196, in parse

    tree.parse(source, parser)

  File "/usr/lib/python3.6/xml/etree/ElementTree.py", line 597, in parse

    self._root = parser._parse_whole(source)

xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 35, column 231

谁能告诉我这段代码有什么问题吗?

python xml-parsing python-3.6
1个回答
-6
投票

bruh这个狗屎,你们都不知道该如何在mofk中编码

© www.soinside.com 2019 - 2024. All rights reserved.