使用Xpath的时候报错
File "src/lxml/lxml.etree.pyx", line 3161, in lxml.etree.HTML (src/lxml/lxml.etree.c:78444)
- 使用.content保存二进制格式的
- 解析的时候转换一下
html = bytes(bytearray(html, encoding='utf-8'))
selector = etree.HTML(html)
使用Xpath的时候报错
File "src/lxml/lxml.etree.pyx", line 3161, in lxml.etree.HTML (src/lxml/lxml.etree.c:78444)
html = bytes(bytearray(html, encoding='utf-8'))
selector = etree.HTML(html)