Python is one of the most powerful and beginner-friendly programming languages for automating repetitive tasks. Whether you’re a developer, data analyst, or just someone who spends hours on manual computer work, Python can help you save time and reduce errors with simple automation scripts.
From organizing your files and sending emails to generating reports and scraping data from websites, Python’s extensive library ecosystem makes it incredibly versatile. With just a few lines of code, you can automate tasks that would otherwise take hours to complete manually.
In this tutorial, we’ll explore 10 practical Python scripts that you can use to automate your daily tasks. Each example comes with clear explanations and ready-to-use code so you can follow along and adapt them to your workflow. By the end, you’ll have a collection of scripts to boost your productivity and free up time for more important work.
Whether you’re new to Python or an experienced programmer looking for inspiration, these automation examples will show you just how powerful and flexible Python can be in everyday scenarios.
Prerequisites
Before diving into the automation scripts, make sure your development environment is ready. You don’t need advanced Python knowledge — just a basic understanding of how to write and run Python code.
Here’s what you’ll need:
1. Python Installed
Make sure Python 3.11 or later is installed on your system.
You can check your version by running:
python3 --version
If Python is not installed, download it from python.org/downloads and follow the installation guide for your operating system (Windows, macOS, or Linux).
2. pip (Python Package Manager)
pip
allows you to install external libraries used in the scripts below. It’s usually included with Python, but you can confirm with:
pip3 --version
To upgrade pip:
python -m pip install --upgrade pip
3. Text Editor or IDE
Use your preferred code editor for writing and testing Python scripts. Popular choices include:
-
VS Code
-
Sublime Text
4. Running Scripts from the Terminal
Each script can be executed directly from the terminal or command prompt:
python script_name.py
This simple setup ensures you can follow all examples in this tutorial without extra configuration.
Below are ten practical Python scripts to automate common everyday tasks. Each one uses standard or popular Python libraries, and you can easily adapt them to your own projects.
1. Automatically Rename and Organize Files in a Folder
If your Downloads folder is cluttered with random files, this script can automatically organize them into subfolders by file type.
import os
import shutil
def organize_folder(folder_path):
for filename in os.listdir(folder_path):
file_path = os.path.join(folder_path, filename)
if os.path.isfile(file_path):
file_ext = filename.split('.')[-1].lower()
target_dir = os.path.join(folder_path, file_ext.upper())
os.makedirs(target_dir, exist_ok=True)
shutil.move(file_path, os.path.join(target_dir, filename))
print("✅ Files have been organized successfully!")
# Example usage
organize_folder("/path/to/your/Downloads")
💡 Tip: Change the folder path to any directory you want to be organized automatically.
2. Send Automated Emails with Attachments
Use this script to send an email automatically, perfect for daily reports or alerts.
import smtplib
from email.message import EmailMessage
def send_email(sender, password, recipient, subject, body, attachment=None):
msg = EmailMessage()
msg["From"] = sender
msg["To"] = recipient
msg["Subject"] = subject
msg.set_content(body)
if attachment:
with open(attachment, "rb") as f:
msg.add_attachment(f.read(), maintype="application", subtype="octet-stream", filename=f.name)
with smtplib.SMTP_SSL("smtp.gmail.com", 465) as smtp:
smtp.login(sender, password)
smtp.send_message(msg)
print("📧 Email sent successfully!")
# Example usage
# send_email("[email protected]", "yourpassword", "[email protected]", "Daily Report", "Here’s today’s report.", "report.pdf")
💡 Tip: For Gmail, enable “App Passwords” under Google Account → Security.
3. Extract Text from PDFs
This script extracts all text from a PDF file — great for quickly searching or summarizing documents.
import PyPDF2
def extract_text_from_pdf(pdf_path):
with open(pdf_path, "rb") as pdf:
reader = PyPDF2.PdfReader(pdf)
text = ""
for page in reader.pages:
text += page.extract_text()
return text
# Example usage
# print(extract_text_from_pdf("example.pdf"))
💡 Tip: Combine this with a keyword search or AI summarization tool to automate document analysis.
4. Scrape Website Data into a CSV
Easily extract and save website data using requests
and BeautifulSoup
.
import requests
from bs4 import BeautifulSoup
import csv
def scrape_to_csv(url, csv_file):
response = requests.get(url)
soup = BeautifulSoup(response.text, "html.parser")
titles = [h2.text.strip() for h2 in soup.find_all("h2")]
with open(csv_file, "w", newline="", encoding="utf-8") as f:
writer = csv.writer(f)
writer.writerow(["Title"])
for title in titles:
writer.writerow([title])
print("✅ Data saved to", csv_file)
# Example usage
# scrape_to_csv("https://example.com/blog", "titles.csv")
💡 Tip: Customize the HTML element (e.g., h2
, p
, .class-name
) for your specific scraping needs.
5. Convert Images to Another Format in Bulk
Quickly convert all images in a folder to another format, such as PNG to JPG.
from PIL import Image
import os
def convert_images(folder_path, output_format="JPEG"):
for filename in os.listdir(folder_path):
if filename.lower().endswith((".png", ".jpg", ".jpeg")):
img_path = os.path.join(folder_path, filename)
img = Image.open(img_path)
new_filename = os.path.splitext(filename)[0] + "." + output_format.lower()
img.convert("RGB").save(os.path.join(folder_path, new_filename), output_format)
print("🖼️ All images converted successfully!")
# Example usage
# convert_images("/path/to/images", "JPEG")
6. Generate Daily System Reports (CPU, Memory, Disk Usage)
Monitor your computer’s performance and generate daily reports automatically.
import psutil
from datetime import datetime
def system_report():
cpu = psutil.cpu_percent(interval=1)
memory = psutil.virtual_memory().percent
disk = psutil.disk_usage('/').percent
report_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
report = (
f"System Report ({report_time})\n"
f"CPU Usage: {cpu}%\n"
f"Memory Usage: {memory}%\n"
f"Disk Usage: {disk}%\n"
)
with open("system_report.txt", "a") as f:
f.write(report + "\n")
print("💻 System report generated successfully!")
# Example usage
# system_report()
💡 Tip: You can schedule this script to run daily using cron or Task Scheduler.
7. Backup Important Files Automatically
This script copies your important files to a backup folder with a timestamp.
import shutil
import os
from datetime import datetime
def backup_files(source_folder, backup_folder):
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
dest = os.path.join(backup_folder, f"backup_{timestamp}")
shutil.copytree(source_folder, dest)
print(f"🗂️ Backup completed: {dest}")
# Example usage
# backup_files("/path/to/source", "/path/to/backup")
💡 Tip: Combine this with a scheduler to create daily or weekly automatic backups.
8. Rename Bulk Photos by Date Taken
Organize your photo collection by renaming files using the date captured in EXIF metadata.
from PIL import Image
from PIL.ExifTags import TAGS
import os
def rename_photos_by_date(folder_path):
for filename in os.listdir(folder_path):
if filename.lower().endswith((".jpg", ".jpeg")):
path = os.path.join(folder_path, filename)
img = Image.open(path)
exif_data = img.getexif()
for tag, value in exif_data.items():
if TAGS.get(tag) == "DateTimeOriginal":
date = value.replace(":", "").replace(" ", "_")
new_name = f"{date}.jpg"
os.rename(path, os.path.join(folder_path, new_name))
print(f"Renamed {filename} → {new_name}")
break
print("📸 All photos renamed by date!")
# Example usage
# rename_photos_by_date("/path/to/photos")
💡 Tip: Works best on photos from cameras or phones that store EXIF metadata.
9. Auto-Send WhatsApp Messages
Easily send scheduled WhatsApp messages using pywhatkit
.
import pywhatkit as kit
def send_whatsapp_message(phone_no, message, hour, minute):
kit.sendwhatmsg(phone_no, message, hour, minute)
print("💬 WhatsApp message scheduled successfully!")
# Example usage
# send_whatsapp_message("+1234567890", "Good morning! ☀️", 9, 30)
💡 Tip: The browser must stay open for the message to send automatically.
10. Automate Excel Updates and Reports
Update and manipulate Excel files automatically using openpyxl
.
from openpyxl import load_workbook
def update_excel(file_path, sheet_name, cell, value):
wb = load_workbook(file_path)
ws = wb[sheet_name]
ws[cell] = value
wb.save(file_path)
print(f"📊 Updated {sheet_name}:{cell} with value '{value}'")
# Example usage
# update_excel("report.xlsx", "Sheet1", "B2", 1500)
💡 Tip: Combine this script with the email automation script to send updated reports daily.
That completes all 10 Python automation scripts! 🎉
Each one is modular, so you can mix and match them depending on your workflow — or even combine them into a full automation dashboard later.
Bonus – Schedule Scripts to Run Automatically
Writing automation scripts is great, but real productivity comes when they run automatically — without you needing to open a terminal every time. Python makes this easy by combining your scripts with your operating system’s built-in scheduling tools.
Below are simple ways to schedule your scripts on Windows, macOS, and Linux.
1. Schedule with Task Scheduler (Windows)
Step 1: Open the Windows Task Scheduler (press Win + S
and search for it).
Step 2: Click Create Basic Task.
Step 3: Give it a name like Daily Backup Script.
Step 4: Choose Daily or Weekly, then click Next.
Step 5: Under Action, select Start a program.
Step 6: In Program/script, browse to your Python executable, e.g.:
C:\Python311\python.exe
Step 7: In Add arguments, type your script path, for example:
C:\path\to\backup_script.py
Step 8: Save, and your script will now run automatically at your chosen time!
💡 Tip: You can check logs and success messages in Task Scheduler’s History tab.
2. Schedule with Cron (macOS and Linux)
Step 1: Open your terminal.
Step 2: Run:
crontab -e
Step 3: Add a new cron job. For example, to run a script every day at 8 AM:
0 8 * * * /usr/bin/python3 /home/user/scripts/system_report.py
Step 4: Save and exit (Ctrl + O
, then Ctrl + X
).
💡 Tip: Check your cron logs with:
grep CRON /var/log/syslog
3. Using Python’s Built-In schedule
Library
If you prefer not to rely on system tools, you can use the schedule
library inside your Python code.
Install it with:
pip install schedule
Then use it like this:
import schedule
import time
from datetime import datetime
def job():
print(f"Running automation at {datetime.now()}")
schedule.every().day.at("08:00").do(job)
while True:
schedule.run_pending()
time.sleep(1)
This script will run your task daily at 8 AM. You can replace the job()
function with any automation script you wrote earlier.
💡 Tip: Run this in the background (e.g., with nohup
or as a systemd service) for continuous automation.
With scheduling in place, your Python scripts can now handle repetitive tasks fully on autopilot — saving you time and keeping your system or reports up to date every day.
Conclusion + Next Steps
Automation is one of the best ways to boost productivity and eliminate repetitive work — and Python makes it remarkably easy.
In this tutorial, you learned how to build 10 practical Python scripts to simplify your daily tasks, from organizing files and sending emails to generating reports and even scheduling your scripts to run automatically.
Here’s a quick recap of what you’ve achieved:
-
✅ Automated file and image management
-
✅ Extracted and processed data from PDFs and websites
-
✅ Sent automated messages and emails
-
✅ Generated system and Excel reports
-
✅ Scheduled scripts to run automatically
These small automations can save hours each week, letting you focus on creative or analytical tasks instead of tedious manual work.
Next Steps
If you enjoyed this tutorial, here are a few ways to keep improving your automation skills:
-
🔹 Explore the book “Automate the Boring Stuff with Python” by Al Sweigart
-
🔹 Learn about APIs and webhooks to automate cloud-based workflows
-
🔹 Combine your scripts with tools like Flask or FastAPI to turn them into web apps
-
🔹 Use cron jobs, Docker, or cloud functions for professional-grade automation
With these foundations, you’re ready to build custom automation systems for almost anything — from personal productivity tools to business process automation.
You can find the full source code on our GitHub.
That's just the basics. If you need more deep learning about Python, Django, FastAPI, Flask, and related, you can take the following cheap course:
- 100 Days of Code: The Complete Python Pro Bootcamp
- Python Mega Course: Build 20 Real-World Apps and AI Agents
- Python for Data Science and Machine Learning Bootcamp
- Python for Absolute Beginners
- Complete Python With DSA Bootcamp + LEETCODE Exercises
- Python Django - The Practical Guide
- Django Masterclass : Build 9 Real World Django Projects
- Full Stack Web Development with Django 5, TailwindCSS, HTMX
- Django - The Complete Course 2025 (Beginner + Advance + AI)
- Ultimate Guide to FastAPI and Backend Development
- Complete FastAPI masterclass from scratch
- Mastering REST APIs with FastAPI
- REST APIs with Flask and Python in 2025
- Python and Flask Bootcamp: Create Websites using Flask!
- The Ultimate Flask Course
Happy coding, and may your future workflows run effortlessly with Python! 🐍⚡