我正在尝试使用请求解析 xml 文档(URL),
面临以下错误:
ValueError: Unicode strings with encoding declaration are not supported
这是我的代码:
import requests
from lxml import etree
from lxml.etree import fromstring
req = requests.request('GET', "http://www.nbp.pl/kursy/xml/LastC.xml")
a = req.text
b = etree.fromstring(a)
我怎样才能得到这个 xml 解析。提前感谢您的帮助