python periodic doing something

10 is the interval in second...foo is the function to run.

>>> import time, threading
>>> def foo():
... print(time.ctime())
... threading.Timer(10, foo).start()
...




>>> foo()
Thu Dec 22 14:46:08 2011
>>> Thu Dec 22 14:46:18 2011
Thu Dec 22 14:46:28 2011
Thu Dec 22 14:46:38 2011

留言

這個網誌中的熱門文章

GeoSetter how to add geotag on to pictures, and export to google earth as kmz

VESC hall sensor table and use it to add hall sensors to RC sensorless motor, then nake it work with RC sensored ESC

Meshtastic LilyGo lora32 pins? which can be used, which is used on meshtastic