First, my code is here:
import schedule # see https://github.com/dbader/schedule
import crawler
def job():
print("Start my scheduled job...")
cw.run()
if __name__ == "__main__":
cw = crawler.crawler()
print("Initial crawling...")
cw.run()
schedule.every(10).seconds.do(job)
while True:
schedule.run_pending()
for title, link in zip(cw.titles, cw.links):
print("%s[%s]" % (title, link))
In the while
loop, I want to execute the for
loop only after the scheduled job finish.
But, that for
loop is running infinitely.
I know why. But I don't know how to fix it.
Can anyone help me?