While you can schedule a Python program to be executed at a specific time every day on your local computer, you will need to have the computer running 24/7, so this soon becomes impractical. And that is one of the reasons why servers exists. An easy and free way to execute Python scripts automatically every day is to use PythonAnywhere servers. Here are the steps:
1. Create a free account on https://www.pythonanywhere.com and log in.
2. Go to the Files menu on PythonAnywhere and upload your Python script.
3. Go to the Tasks menu.
4. Enter the time you want the Python script to be executed in the time field. The time should be in the UTC system.
5. Enter python /home/username/script.py in the field next to the time field. That is the command that PythonAnywhere will run at the given time and it points to the location where you uploaded your Python script. Note that you need to change username with your actual PythonAnywhere username and script.py with the name of the Python script you uploaded in step 2.
6. Press the Create button. Your script will now be executed every day at the time you specified.
Learn Flask development and learn to build cool apps with our premium Python course on Udemy.
We will keep you Python-motivated if you subscribe below.