低調的D吖 2020-03-03 21:51 采纳率: 0%
浏览 1220

python3 報錯這個TypeError: expected string or bytes-like object如何解決

def get_img(html):
  p = r'src="(https://img.*?\.jpg)"pic_ext'
  imgsa = re.compile(p)
  imglist = re.findall(imgsa,html)
  • 写回答

1条回答 默认 最新

  • threenewbee 2020-03-03 22:26
    关注

    html不是字符串
    用print(type(html))
    输出下看看html是什么类型
    转换成字符串

    评论

报告相同问题?