user2990334 user2990334 - 1 month ago 8
Python Question

How can I get a python code to run over and over again?

I have a scraper that scrapes data from a website, then saves the data in .csv files. What I am looking for is a way to run this code every 10 minutes, without using a loop. I have very little knowledge on how to do this. What approach would you use?

Answer

Are you using windows or a unix based system?

If you're using UNIX, you can schedule jobs to take place at regular intervals with CRON.

Execute the following in a terminal window:

#edit crontab
crontab -e

Then add the required file you want to execute prefaced by the following CRON instructions:

*/6 * * * * /path/to/desired/Python_version /path/to/executable/file
Comments