do something every n seconds

km srikrishnamohan at gmail.com
Thu Nov 25 19:06:32 CET 2010


while True:
   time.sleep(10)
   print('hello python!')

HTH,
KM
On Thu, Nov 25, 2010 at 8:35 PM, Steve Holden <steve at holdenweb.com> wrote:
> On 11/25/2010 6:38 AM, Santiago Caracol wrote
>> Hello,
>>
>> how can I do something (e.g. check if new files are in the working
>> directory) every n seconds in Python?
>>
> Look at the sched library, which was written to take care of
> requirements like this. Use time.sleep() as your delay function and
> time.time() as your time function.
>
> regards
>  Steve
> --
> Steve Holden           +1 571 484 6266   +1 800 494 3119
> PyCon 2011 Atlanta March 9-17       http://us.pycon.org/
> See Python Video!       http://python.mirocommunity.org/
> Holden Web LLC                 http://www.holdenweb.com/
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list