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")

 

posted on 2019-05-01 09:40  wyhluckydog  阅读(9414)  评论(2编辑  收藏  举报