Scheduling Python Programs

2020-05-01 08:22发布

How would you go about a having a function check something every ten minutes? I would like to check a directory for new files every ten minutes. I know python has a time library but can it be used for this?

3条回答
戒情不戒烟
2楼-- · 2020-05-01 08:25

The sched module is worth a look.

查看更多
可以哭但决不认输i
3楼-- · 2020-05-01 08:36

for checking of files, you may want to try pyinotify

查看更多
▲ chillily
4楼-- · 2020-05-01 08:41

time.sleep:

time.sleep(10*60)

you might want to look into cron or Scheduled Tasks services of the OS.

查看更多
登录 后发表回答