Hi im trying to make a python script which will perform google searches with and without websites that you pick based on keywords. However my script doesn't ignore the search action even when a website variable is empty. Instead it just closes the window. Im really new to Python so I would really appreciate it if someone could nudge me in the right direction on this one.
from googlesearch import search
print("Results including the websites you picked:")
if website1 != "":
for y in keyword_list:
for i in search(website1+y, tld='com', lang='en', num=1, start=0, stop=1, pause=2.0):
print (i)
else:
print("-None")
if website2 != "":
for y in keyword_list:
for i in search(website2+y, tld='com', lang='en', num=1, start=0, stop=1, pause=2.0):
print (i)
else:
print("-None")
if website3 != "":
for y in keyword_list:
for i in search(website3+y, tld='com', lang='en', num=1, start=0, stop=1, pause=2.0):
print (i)
else:
print("-None")
if website4 != "":
for y in keyword_list:
for i in search(website4+y, tld='com', lang='en', num=1, start=0, stop=1, pause=2.0):
print (i)
else:
print("-None")
if website5 != "":
for y in keyword_list:
for i in search(website5+y, tld='com', lang='en', num=1, start=0, stop=1, pause=2.0):
print (i)
else:
print("-None")
input("press ENTER to continue")
print("Results not including the websites you picked:")
for y in keyword_list:
for i in search(y, tld='com', lang='en', num=1, start=0, stop=1, pause=2.0):
print (i)
input("press ENTER to exit")
Aucun commentaire:
Enregistrer un commentaire