学习的时候调用 etree.HTML() 出现报错信息
xml etree.HTML(content)# 报错信息
ValueError: can only parse strings网上搜索了下,好几个回答都是etree.HTML(content.text) 在参数中调用属性,他们好像都行,但我这是不行,会提示…
问题:
TypeError: cannot use a string pattern on a bytes-like object解决方式:
def getimg(html):reg rsrc"(.*?\.jpg)"imgre.compile(reg)# 把html 指定编码格式,解决问题# htmlhtml.decode(utf-8) # python3imglistre.fi…