BeautifulSoup: object of type 'Response' has no len()

前端 未结 7 1463
深忆病人
深忆病人 2020-12-05 09:55

Issue: when I try to execute the script, BeautifulSoup(html, ...) gives the error message \"TypeError: object of type \'Response\' has no len(). I tried passing

7条回答
  •  有刺的猬
    2020-12-05 10:56

    You are getting response.content. But it return response body as bytes (docs). But you should pass str to BeautifulSoup constructor (docs). So you need to use the response.text instead of getting content.

提交回复
热议问题