do something every n seconds

Alice Bevan–McGregor alice at gothcandy.com
Thu Nov 25 07:51:52 EST 2010


> how can I do something (e.g. check if new files are in the working
> directory) every n seconds in Python?

The simplest method is executing time.sleep(n) within an infinite while 
loop.  There are more elegant solutions: using coroutine frameworks, 
threaded task schedulers, etc.

	— Alice.




More information about the Python-list mailing list