datetime - Python - time: how to check if seconds == 00 -
in script want run function when seconds 00. example if start script @ 8:12:32, want function start @ 8:13:00. have tried use datetime.datetime.now() haven't figured out how sort out seconds time. in python 3 documentation have found time.second , datetime.second haven't had success using them.
import datetime, time delta = 60 - datetime.datetime.now().second time.sleep(delta)
the next statement executed on minute (hh:mm:00
).
Comments
Post a Comment