请考虑以下代码:
import xml.etree.ElementTree as ET
import urllib
XML_response = urllib.urlopen('http://www.navlost.eu/aero/metar/?icao=LWSK&dt0=2011-05-03+12%3A00%3A00&c=1&rt=metar').read()
tree = ET.fromstring(XML_response)
提出此错误:
---------------------------------------------------------------------------
ExpatError Traceback (most recent call last)
C:\Python26\<ipython-input-82-64c111a1ce76> in <module>()
----> 1 tree = ET.fromstring(XML_response)
C:\Python26\lib\xml\etree\ElementTree.pyc in XML(text)
961 def XML(text):
962 parser = XMLTreeBuilder()
--> 963 parser.feed(text)
964 return parser.close()
965
C:\Python26\lib\xml\etree\ElementTree.pyc in feed(self, data)
1243
1244 def feed(self, data):
-> 1245 self._parser.Parse(data, 0)
1246
1247 ##
**ExpatError: not well-formed (invalid token): line 12, column 28**
这是XML_response:http://paste.pocoo.org/show/401984/
问题是我无法理解为什么第12行,第28列(或常规短划线或45字符)链接到此错误。 可能Python试图告诉我一些事情,但我看不出是什么