0
我试图用ElementTree的解析XML,但我得到这个错误:解析XML与元素树
xml.etree.ElementTree.ParseError: encoding specified in XML declaration is incorrect
我file.py:
from suds.client import Client
import xml.etree.ElementTree as ET
url = 'http://www.webservicex.com/globalweather.asmx?WSDL'
client = Client(url)
weather = client.service.GetWeather('Sao Paulo', 'Brazil')
print weather
parseWeather = ET.fromstring(weather) # >>>> Here I got my problem!
当我尝试解析我的XML从串天气。任何人都知道如何解决这类问题?
它看起来replace()方法打开'weather'为一个字符串。 Martijn有正确的答案。 – Rohmer