The insight most beginners miss: you don't need to be a Python expert to automate 80% of your repetitive tasks. Five libraries cover almost every common automation scenario — files, web, spreadsheets, email, and scheduled jobs.
Rename, move, sort, and organize files automatically using built-in os, shutil, and pathlib — no installs needed.
import shutil, os, pathlib
# Auto-sort Downloads folder by extension
downloads = pathlib.Path.home() / "Downloads"
for file in downloads.iterdir():
if file.suffix == ".pdf":
dest = downloads / "PDFs"
dest.mkdir(exist_ok=True)
shutil.move(str(file), str(dest / file.name))Use Playwright (modern, fast) or Selenium (widely supported) to click buttons, fill forms, and extract data from any website.
# pip install playwright
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page()
page.goto("https://example.com")
print(page.title())
browser.close()Use openpyxl (Excel .xlsx) or pandas (CSV/data manipulation) to read, write, and transform spreadsheets without opening them.
# pip install openpyxl
import openpyxl
wb = openpyxl.load_workbook("report.xlsx")
ws = wb.active
for row in ws.iter_rows(min_row=2, values_only=True):
print(row) # Process each row automaticallyPython's built-in smtplib sends emails. For reading and processing emails, use imaplib or the ezgmail library for Gmail.
import smtplib
from email.mime.text import MIMEText
msg = MIMEText("Automated report attached.")
msg["Subject"] = "Daily Report"
msg["From"] = "you@gmail.com"
msg["To"] = "boss@company.com"
with smtplib.SMTP_SSL("smtp.gmail.com", 465) as smtp:
smtp.login("you@gmail.com", "app-password")
smtp.send_message(msg)Run your scripts automatically at set times using schedule (simple Python loop) or the OS scheduler (Task Scheduler on Windows, cron on Mac/Linux).
# pip install schedule
import schedule, time
def daily_job():
print("Running daily automation...")
schedule.every().day.at("08:00").do(daily_job)
while True:
schedule.run_pending()
time.sleep(60)Use pyautogui to control your mouse and keyboard — automate any desktop app, even ones with no API.
# pip install pyautogui
import pyautogui, time
time.sleep(2) # 2s to switch to target window
pyautogui.hotkey("ctrl", "a") # Select all
pyautogui.typewrite("Automated text", interval=0.05)pathlib + shutil (built-in)playwright or requests + beautifulsoup4pandas + openpyxlsmtplib (built-in) or ezgmailschedulepyautoguiPro tip: Always add try/except blocks and logging to your automation scripts. Automations run unattended — if they fail silently, you won't know for hours. Use Python's built-in logging module to write errors to a file: logging.basicConfig(filename='automation.log', level=logging.ERROR). This single habit separates hobbyist scripts from production-grade automation.
The #1 beginner resource for Python automation — covers files, PDFs, spreadsheets, web scraping, and scheduling. Free to read online, or buy the print edition.
Intermediate-level book covering real-world automation recipes including web scraping, data pipelines, and report generation.
Best modern browser automation library — faster and more reliable than Selenium. Essential if you're automating web tasks.
Comprehensive video course with automation projects included — good if you prefer video learning over books.
Free and premium written tutorials specifically on Python automation — great reference library while building scripts.
Best Python IDE for writing automation scripts — smart autocomplete, debugger, and built-in terminal. Community edition is free.
This page is part of Pyflo's featured answer set — a curated, public collection of common questions. Your own searches are private and never indexed. See our Privacy Policy.