-1

I want to make a Python program do some task at some times of the day (for example at 12:00, 12:30,13:00, 13:30, etc.) without using sleep(), so the program can make other tasks while it waits.

  • Are you sure python is the best way to do this? Also, what operationnal system are you working with? – Matina G Nov 19 '18 at 13:48
  • 4
    You should probably use tools provided by your OS rather than writing it yourself in Python. You can use things like [`Task Scheduler`](https://learn.microsoft.com/en-us/windows/desktop/taskschd/task-scheduler-start-page) on Windows or [`Cron`](http://man7.org/linux/man-pages/man5/crontab.5.html) on Linux. – 0x5453 Nov 19 '18 at 13:49
  • I am working on windows 10. I am using python to read some data in a PLC. – Andres Halliday Martinez Nov 19 '18 at 13:53

1 Answers1

0

datetime.datetime.now().time() will get the current time. Thus, create simple if statements that check for the time, and if they match, execute the code.