E
E
Ernest Vardanyan2020-06-01 17:50:19
Python
Ernest Vardanyan, 2020-06-01 17:50:19

How to run code on computer time?

Hello, how can I run the code based on the time on the computer. For example, I run the code at 18:00 and it parses the data, for example, it finishes at 18:03, it needs to be launched at 18:05, roughly speaking every 5 minutes, but 5 minutes from the computer time, and not every 5 minutes after closing the tab during the parser (I work on selenium). 18:00, 18:05, 18:10, etc.?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Armenian Radio, 2020-06-01
@gbg

On Linux, this is cron
On the window - Task Scheduler

F
FaustGette, 2020-06-01
@FaustGette

import schedule

def job():
    print("Код")
    print("<Парсит>")

# каждые 5 минут
schedule.every(5).minutes.do(job)
# каждый день в 18:00
schedule.every().day.at("18:00").do(job)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question