I need to run
Код: Выделить всё
XКод: Выделить всё
2pi/24Код: Выделить всё
2pi/3.5So I have the total daily tasks I want to run and I need to know how much time to sleep between them, according to time of day - how can I get to that equation? Can this be achieved in a simpler manner?
Example:
Код: Выделить всё
from datetime import datetime
from time import sleep
def get_daily_tasks(...):
...
def run_task(...):
...
def main(): # to be run daily
num_tasks = get_daily_tasks(...)
for _ in range(num_tasks):
run_task(...)
sleep_timer = sleep_timer(num_tasks, datetime.now()) # This is what I need to find
sleep(sleep_timer)
Источник: https://stackoverflow.com/questions/781 ... e-function