Python Google Search Webscraping查询错误:builtins.TypeError:Search()获取了意外的关键字参数';tld&x27;
我一直在用Python和谷歌搜索查询来尝试网络垃圾。当我尝试使用我生成的文本文件中的随机文本执行查询时,我收到以下错误: 第234行,在 对于搜索中的j(query,tld=“ca”,num=10,stop=10,pause=pause\u rand,user\u agent=str(headers)): 错误:builtins.TypeError:search()获得意外的关键字参数“tld” 我在两台独立的机器中使用此python代码,其中一台机器没有收到此错误,并且在第二台机器发生错误时运行,没有任何问题。据我所知,这两台不同的机器应该运行相同版本的python等Python Google Search Webscraping查询错误:builtins.TypeError:Search()获取了意外的关键字参数';tld&x27;,python,web-scraping,Python,Web Scraping,我一直在用Python和谷歌搜索查询来尝试网络垃圾。当我尝试使用我生成的文本文件中的随机文本执行查询时,我收到以下错误: 第234行,在 对于搜索中的j(query,tld=“ca”,num=10,stop=10,pause=pause\u rand,user\u agent=str(headers)): 错误:builtins.TypeError:search()获得意外的关键字参数“tld” 我在两台独立的机器中使用此python代码,其中一台机器没有收到此错误,并且在第二台机器发生错误时运
with open(""+elems+"", "r", encoding='utf8') as a_file:
mydoc = Document()
#print(filename)
mydoc.add_paragraph("Results for " +str(filename_for_analysis[counter])+ ":")
line_num = 1
for line in a_file:
if line.strip():
stripped_line = line.strip()
mydoc.add_paragraph("Results for Line#"+str(line_num)+'\n'+str(stripped_line)+"")
#results_file = open("Results.txt", "a+", encoding = 'utf-8')
stack = []
confirmedSite_stack = []
safeSite_stack = []
ErrorSite_stack = []
Downloadable_stack = []
FoundText = []
print("Line:")
print(stripped_line)
query = scramble(stripped_line)
print("Query:")
print(query)
pause_rand = random.randint(5,7)
#Performs a query of the line from the .txt file
for j in search(query, tld="ca", num=2, stop=2, pause = pause_rand, user_agent= str(headers)):
stack.append(j)
您可以指定您使用的库吗?@HarshanaSerasinghe它是python google库您可以指定您使用的库吗?@HarshanaSerasinghe它是python google库