我正在做一个关于如何在youtube上找到webscrape的例子,并一步一步地介绍它。 https://www.youtube.com/watch?v=3xQTJi2tqgk 这是我的代码和我不断得到的错误。你知道吗
import requests
from bs4 import BeautifulSoup
url = ('http://www.yellowpages.com/search?search_terms=coffee&geo_location_terms=Los+Angeles%2C+CA')
r = requests.get(url)
soup = BeautifulSoup(r.content)
links = soup.find_all("a")
for link in links:
print "<a href='%s'>%s</a>" %(link.get("href"), link.text)
g_data = soup.find_all("div", {"class": "info"})
print g_data
错误
Traceback (most recent call last):
line 8, in <module>
soup = BeautifulSoup(r.content)
TypeError: __init__() takes at least 5 arguments (2 given)
我尝试在其他文件上使用soup模块,但仍然无法工作。有什么想法吗?提前谢谢!你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐