P i
P i

Reputation: 30674

Schedule an event for a certain unix timestamp in Python

How to implement the following?

def thirty_seconds_in():
    print('meow')

at_time( time() + 30, thirty_seconds_in )

Do I need my own thread/runloop with a sleep(.01) in it?

Upvotes: 0

Views: 280

Answers (1)

piertoni
piertoni

Reputation: 2021

The first solution is, like you said, to implement your own loop.

The second solution is to use some given library functions like sched.

But in fact you need a runtime loop that will perform a check.

Upvotes: 2

Related Questions