从<htmlelement> Python中删除BOM字符

时间:2018-03-26 12:43:04

标签: python python-requests byte-order-mark

我试图以这种方式从URL加载html标记,然后运行一些xpath查询,但是页面源加载了BOM,如何在运行xpath之前删除它们?

session = requests.Session()

page = session.get(url)

page_data = lxml.html.fromstring(page.text)

输出:

 u'Re\ufeffverse \ufeffFleece \ufeffHoo\ufeffded S\ufeffwea\ufefftshi\ufeffrt'

1 个答案:

答案 0 :(得分:0)

http://myEndpoint?myParam1=10&myParam2=hello