[Python] Repeat python function at every system clock minute

Discussão em 'Python' iniciado por Stack, Novembro 21, 2024.

  1. Stack

    Stack Membro Participativo

    I've seen that I can repeat a function with python every x seconds by using a event loop library in this post:

    import sched, time
    s = sched.scheduler(time.time, time.sleep)
    def do_something(sc):
    print("Doing stuff...")
    # do your stuff
    s.enter(60, 1, do_something, (sc,))

    s.enter(60, 1, do_something, (s,))
    s.run()


    But I need something slightly different: I need that the function will be called at every system clock minute: at 11:44:00PM, 11:45:00PM and so on.

    How can I achieve this result?

    Continue reading...

Compartilhe esta Página