如何在没有任务调度程序的情况下重启python程序?

时间:2017-10-05 07:01:40

标签: python loops web-scraping debian restart

我正在抓取一些数据,当我完成所有网站时,我想再次启动此过程,例如使用重启代码(如果它存在于Python中)。我可以在Python 2.7的Debian系统上没有Task Scheduler / Gnome吗?

我的代码如下:

.
.
.
browser = webdriver.Firefox()
datatable=[]

browser.get('LINK1')
time.sleep(5) 
browser.find_element_by_xpath('//button[contains(text(), "ITS A CLICK EVENT")]').click()
time.sleep(5)
browser.find_element_by_xpath('//button[contains(text(), "ITS A CLICK EVENT AGAIN")]').click()
html = browser.page_source
soup=BeautifulSoup(html,"html.parser")
table = soup.find('table', { "class" : "table table-condensed table-hover data-table m-n-t-15" })
name = soup.h2.string
name2 = soup.h1.string
name3 = soup.h3.string
name4 = datetime.now()
#HERE I EXPORT THESE DATAES INTO A DATABASE

#AND HERE START MY NEW WEBSITE.
    browser = webdriver.Firefox()
datatable=[]

browser.get('LINK2')
time.sleep(5) 
browser.find_element_by_xpath('//button[contains(text(), "ITS A CLICK EVENT")]').click()
time.sleep(5)
browser.find_element_by_xpath('//button[contains(text(), "ITS A CLICK EVENT AGAIN")]').click()
html = browser.page_source
soup=BeautifulSoup(html,"html.parser")
table = soup.find('table', { "class" : "table table-condensed table-hover data-table m-n-t-15" })
name = soup.h2.string
name2 = soup.h1.string
name3 = soup.h3.string
name4 = datetime.now()
.
.
.
#WHAT CAN I WRITE IN THE END TO RESTART THIS ALL PROGRAM? IS THERE ANY RESTART CODE?

0 个答案:

没有答案