1.检查自己脚本文件的命名是否命名成了bs4.py,如果命名成了bs4.py,程序则会在该文件下去找beautifulsoup,所以会报错。将文件名进行重命名即可。

2.如果第一种办法不能解决,查看自己导入import beautifulsoup的写法,其中B和S都应该大写,否则也是找不到的。正确的写法为:

from bs4 import BeautifulSoup
r=requests.get("https://python123.io/ws/demo.html")
demo=r.text
soup=BeautifulSoup(demo,"html.parser")

 

相关文章:

  • 2021-11-03
  • 2022-02-10
  • 2021-05-25
  • 2022-01-02
  • 2021-11-19
  • 2022-12-23
  • 2021-07-23
  • 2022-12-23
猜你喜欢
  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2021-10-29
相关资源
相似解决方案