我试过:
pip install beautifulsoup4
pip install beautifulsoup
pip3 install beautifulsoup4
pip3 install beautifulsoup
easy_install beautifulsoup4
easy_install beautifulsoup
它是为了这个项目:
import requests
import beautifulsoup
website = input("What website do you want to look at, please include the full web adress")
session = requests.session()
req = session.get(website)
doc = BeautifulSoup.BeautifulSoup(req.content)
print(doc.findAll('a', { "class" : "gp-share" }))
在终端(我在raspberry Pi3上),它说我已经成功地安装了它,但是当我运行程序时,它说没有beautiful soup
。在
如有任何帮助,我们将不胜感激
包调用区分大小写,如果已成功安装,请将Soup构造代码字符串放在如下位置:
doc = beautifulsoup.BeautifulSoup(req.content)
漂亮的汤documentation在教程中包含了一个使用
from bs4 import BeautifulSoup
导入模块的示例。在因此,在您的情况下,替换:
import beautifulsoup
与from bs4 import BeautifulSoup
以及
doc = BeautifulSoup.BeautifulSoup(req.content)
带{相关问题 更多 >
编程相关推荐