I'm trying to parse a KML service using the following:
import requests
import responses
import xml.etree.ElementTree as ET
response = requests.get('http://206.74.144.42/eitms/roadconditions/')
data = str(response.content)
tree = ET.fromstring(data)
but it keeps telling me that the XML is 'not well formed' like so:
not well-formed (invalid token): line 1, column 1
what does this mean and how do I fix it? Using Python 3.6.
直接调用fromstring(response.content)
,而不用str()
进行转换。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.