我正在尝试使用以下代码在Yahoo中搜索查询:
import re
import requests
query = "deep"
yahoo = "https://search.yahoo.com/search?q=" + query
raw_page = requests.get(yahoo)
但是我收到这样的错误:
TypeError: init ()得到了意外的关键字参数'strict'
该错误发生在最后一行。我该如何解决?
这是整个代码:
import re
import requests
no = 10
query = "deep"
yahoo = "https://search.yahoo.com/search?q=" + query + "&n=" + str(no)
#yahoo = "https://search.yahoo.com/search?p=" + query
raw_page = requests.get(yahoo)
results = re.findall(r'(?<=<h3 class="r"><a href="/url\?q=).*?(?=&)', str(raw_page))
res = list(set(results))[0:30] #Provides 30 unique of the 35 we requested above
print(res)
这是错误轨道: