September 25, 2026
20 Python Scripts To Automate Your Daily Tasks
You’re not lazy. You’re efficient. Let Python take over the boring stuff.

By Abdul Ahad
6 min read
"Want to get started with Python from beginning to Expert?" click here"
or
"Want a pack of prompts that work for you and save hours? click here"
Non-Member? Read it for free Here.
Let's face it no matter how much we love coding, most of our daily digital tasks are mind-numbingly repetitive. From renaming files and scraping emails to organizing PDFs and muting Slack during meetings the digital chaos is real.
But here's the good news: Python doesn't just shine in data science and backend magic it's your behind-the-scenes butler for daily life. I've been using Python for over 4 years, and automating my routine tasks wasn't just life-changing it was sanity-saving.
In this post, I'm not giving you ideas. I'm giving you real, working scripts. Some are one-liners. Some are weekend-build worthy. All are practical, powerful, and… honestly, pretty satisfying.
Let's roll.
Rename 100+ Files in Seconds
We've all had that "IMG_20210714_83473.jpg" folder staring at us like a digital mess.
import os
folder_path = "path_to_folder"
for count, filename in enumerate(os.listdir(folder_path)):
ext = os.path.splitext(filename)[1]
new_name = f"image_{count+1}{ext}"
os.rename(os.path.join(folder_path, filename), os.path.join(folder_path, new_name))import os
folder_path = "path_to_folder"
for count, filename in enumerate(os.listdir(folder_path)):
ext = os.path.splitext(filename)[1]
new_name = f"image_{count+1}{ext}"
os.rename(os.path.join(folder_path, filename), os.path.join(folder_path, new_name))Why it's cool: Rename photos, documents, or downloads without clicking yourself into a coma.
Stay Ahead in Python — Without the Noise 🐍 Click here to Join!
Python Weekly Brief Stop Wasting Hours Hunting for Python ResourcesEvery week, thousands of new Python libraries, AI frameworks, GitHub…
Auto-Mute Slack (or Teams) During Zoom Calls
Your coworkers don't need to hear your dog barking in stereo.
import time
import pyautogui
# Mute Slack notifications every day at 10AM
while True:
current_time = time.strftime("%H:%M")
if current_time == "10:00":
pyautogui.hotkey("ctrl", "shift", "m") # or customize per platform
time.sleep(60)import time
import pyautogui
# Mute Slack notifications every day at 10AM
while True:
current_time = time.strftime("%H:%M")
if current_time == "10:00":
pyautogui.hotkey("ctrl", "shift", "m") # or customize per platform
time.sleep(60)Pro Tip: Combine with
schedulelibrary to avoid writing a while loop.
Batch Convert Markdown to PDF
For devs who write docs or blog drafts in markdown and want them to look good.
import markdown
import pdfkit
with open("article.md", "r") as f:
html = markdown.markdown(f.read())
pdfkit.from_string(html, "article.pdf")import markdown
import pdfkit
with open("article.md", "r") as f:
html = markdown.markdown(f.read())
pdfkit.from_string(html, "article.pdf")Use Case: Compile your entire Zettelkasten knowledge base into a clean PDF book.
Python Weekly Brief Stop Wasting Hours Hunting for Python ResourcesEvery week, thousands of new Python libraries, AI frameworks, GitHub…
Instantly Extract Emails from Any Website
Emails are still gold. Especially when scraped legally.
import requests, re
url = "https://example.com"
html = requests.get(url).text
emails = re.findall(r"[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+", html)
print(set(emails))import requests, re
url = "https://example.com"
html = requests.get(url).text
emails = re.findall(r"[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+", html)
print(set(emails))Real World: Scrape your university faculty page to batch email professors. No more Ctrl+F.
Auto-Close Annoying Popups
Browser popups and app naggers — meet your match.
import pyautogui
while True:
close_btn = pyautogui.locateCenterOnScreen("close_button_image.png")
if close_btn:
pyautogui.click(close_btn)import pyautogui
while True:
close_btn = pyautogui.locateCenterOnScreen("close_button_image.png")
if close_btn:
pyautogui.click(close_btn)Note: Screenshot the "X" button to match. Works like magic on Windows prompts.
Convert All Word Docs to PDF in a Folder
Because .docx is so 2005.
import win32com.client
import os
word = win32com.client.Dispatch("Word.Application")
folder = "path_to_docs"
for doc in os.listdir(folder):
if doc.endswith(".docx"):
doc_path = os.path.join(folder, doc)
pdf_path = doc_path.replace(".docx", ".pdf")
doc_obj = word.Documents.Open(doc_path)
doc_obj.SaveAs(pdf_path, FileFormat=17)
doc_obj.Close()
word.Quit()import win32com.client
import os
word = win32com.client.Dispatch("Word.Application")
folder = "path_to_docs"
for doc in os.listdir(folder):
if doc.endswith(".docx"):
doc_path = os.path.join(folder, doc)
pdf_path = doc_path.replace(".docx", ".pdf")
doc_obj = word.Documents.Open(doc_path)
doc_obj.SaveAs(pdf_path, FileFormat=17)
doc_obj.Close()
word.Quit()For Windows Only: Sorry Mac users. I still love you.
Python Weekly Brief Stop Wasting Hours Hunting for Python ResourcesEvery week, thousands of new Python libraries, AI frameworks, GitHub…
Weather in Your Terminal
No more tab-switching to check the skies.
import requests
city = "Lahore"
api_key = "your_openweather_api_key"
url = f"https://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
data = requests.get(url).json()
print(f"{city}: {data['main']['temp']}°C, {data['weather'][0]['description']}")import requests
city = "Lahore"
api_key = "your_openweather_api_key"
url = f"https://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
data = requests.get(url).json()
print(f"{city}: {data['main']['temp']}°C, {data['weather'][0]['description']}")Tip: Schedule it to run every morning via cron or Task Scheduler.
Clean Up Your Desktop (Like a Grown-Up)
Sort files into folders by type. Your future self will thank you.
import os
import shutil
path = "C:/Users/you/Desktop"
file_types = {
"Images": [".jpg", ".png", ".jpeg"],
"Docs": [".pdf", ".docx"],
"Zips": [".zip", ".rar"]
}
for file in os.listdir(path):
ext = os.path.splitext(file)[1]
for folder, extensions in file_types.items():
if ext in extensions:
shutil.move(os.path.join(path, file), os.path.join(path, folder, file))import os
import shutil
path = "C:/Users/you/Desktop"
file_types = {
"Images": [".jpg", ".png", ".jpeg"],
"Docs": [".pdf", ".docx"],
"Zips": [".zip", ".rar"]
}
for file in os.listdir(path):
ext = os.path.splitext(file)[1]
for folder, extensions in file_types.items():
if ext in extensions:
shutil.move(os.path.join(path, file), os.path.join(path, folder, file))Pro Tip: Run every Friday evening. Go into the weekend clean.
Summarize Long YouTube Lectures
Because "Watch Later" is code for "Never".
from youtube_transcript_api import YouTubeTranscriptApi
from openai import OpenAI
video_id = "YourYouTubeID"
transcript = YouTubeTranscriptApi.get_transcript(video_id)
text = " ".join([t['text'] for t in transcript])
# Summarize with GPT-4o-mini
response = OpenAI().chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": f"Summarize this: {text}"}],
)
print(response.choices[0].message.content)from youtube_transcript_api import YouTubeTranscriptApi
from openai import OpenAI
video_id = "YourYouTubeID"
transcript = YouTubeTranscriptApi.get_transcript(video_id)
text = " ".join([t['text'] for t in transcript])
# Summarize with GPT-4o-mini
response = OpenAI().chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": f"Summarize this: {text}"}],
)
print(response.choices[0].message.content)Automatically Reply to Emails (With Class)
Let AI draft a smart, short, human-sounding response.
from openai import OpenAI
incoming_email = """Hey, are you available for a quick sync this week?"""
prompt = f"Reply briefly and politely to this email: {incoming_email}"
response = OpenAI().chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": prompt}],
)
print(response.choices[0].message.content)from openai import OpenAI
incoming_email = """Hey, are you available for a quick sync this week?"""
prompt = f"Reply briefly and politely to this email: {incoming_email}"
response = OpenAI().chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": prompt}],
)
print(response.choices[0].message.content)Use Case: Auto-reply when you're deep in flow. Or just tired.
Stay Ahead in Python — Without the Noise 🐍 Click here to Join!
Python Weekly Brief Stop Wasting Hours Hunting for Python ResourcesEvery week, thousands of new Python libraries, AI frameworks, GitHub…
Check for Broken Links in Your Website
Don't let 404s embarrass you in front of clients.
import requests
from bs4 import BeautifulSoup
url = "https://your-portfolio.com"
html = requests.get(url).text
soup = BeautifulSoup(html, "html.parser")
for link in soup.find_all("a"):
try:
res = requests.get(link.get("href"))
if res.status_code != 200:
print(f"Broken: {link.get('href')}")
except:
print(f"Error: {link.get('href')}")import requests
from bs4 import BeautifulSoup
url = "https://your-portfolio.com"
html = requests.get(url).text
soup = BeautifulSoup(html, "html.parser")
for link in soup.find_all("a"):
try:
res = requests.get(link.get("href"))
if res.status_code != 200:
print(f"Broken: {link.get('href')}")
except:
print(f"Error: {link.get('href')}")Auto-Backup Important Files to Cloud
Because external drives will betray you one day.
import shutil
import datetime
source = "C:/Users/you/Documents"
dest = f"D:/Backups/{datetime.date.today()}"
shutil.copytree(source, dest)import shutil
import datetime
source = "C:/Users/you/Documents"
dest = f"D:/Backups/{datetime.date.today()}"
shutil.copytree(source, dest)Add-on: Sync to Dropbox or Google Drive with their CLI APIs.
Schedule Daily Motivational Quotes
Feed your terminal some soul.
import requests
quote = requests.get("https://api.quotable.io/random").json()
print(f"{quote['content']} - {quote['author']}")import requests
quote = requests.get("https://api.quotable.io/random").json()
print(f"{quote['content']} - {quote['author']}")Tip: Add this to
.bashrcor.zshrcfor a quote on every terminal start.
Automatically Kill High-CPU Processes
When Chrome eats 95% of your RAM.
import psutil
for proc in psutil.process_iter(['pid', 'name', 'cpu_percent']):
if proc.info['cpu_percent'] > 80:
psutil.Process(proc.info['pid']).terminate()import psutil
for proc in psutil.process_iter(['pid', 'name', 'cpu_percent']):
if proc.info['cpu_percent'] > 80:
psutil.Process(proc.info['pid']).terminate()Warning: Don't use on production servers. Or during Zoom.
Python Weekly Brief Stop Wasting Hours Hunting for Python ResourcesEvery week, thousands of new Python libraries, AI frameworks, GitHub…
Record Your Screen with Python
No OBS? No problem.
import pyautogui
import cv2
import numpy as np
screen_size = (1920, 1080)
out = cv2.VideoWriter("screen.avi", cv2.VideoWriter_fourcc(*"XVID"), 20.0, screen_size)
for i in range(200):
img = pyautogui.screenshot()
frame = np.array(img)
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
out.write(frame)
out.release()import pyautogui
import cv2
import numpy as np
screen_size = (1920, 1080)
out = cv2.VideoWriter("screen.avi", cv2.VideoWriter_fourcc(*"XVID"), 20.0, screen_size)
for i in range(200):
img = pyautogui.screenshot()
frame = np.array(img)
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
out.write(frame)
out.release()Text Yourself Reminders via Twilio
Set a Python cron to text you, "Drink water."
from twilio.rest import Client
client = Client("SID", "AUTH_TOKEN")
client.messages.create(
to="+123456789",
from_="+198765432",
body="Hydrate. Now."
)from twilio.rest import Client
client = Client("SID", "AUTH_TOKEN")
client.messages.create(
to="+123456789",
from_="+198765432",
body="Hydrate. Now."
)Download All Images from a Website
Scrape and save in seconds.
from bs4 import BeautifulSoup
import requests, os
url = "https://example.com"
html = requests.get(url).text
soup = BeautifulSoup(html, "html.parser")
os.makedirs("images", exist_ok=True)
for img in soup.find_all("img"):
src = img["src"]
img_data = requests.get(src).content
with open(f"images/{src.split('/')[-1]}", 'wb') as f:
f.write(img_data)from bs4 import BeautifulSoup
import requests, os
url = "https://example.com"
html = requests.get(url).text
soup = BeautifulSoup(html, "html.parser")
os.makedirs("images", exist_ok=True)
for img in soup.find_all("img"):
src = img["src"]
img_data = requests.get(src).content
with open(f"images/{src.split('/')[-1]}", 'wb') as f:
f.write(img_data)Auto-Sort PDFs Based on Content
Organize your research papers like a pro.
import fitz
from sentence_transformers import SentenceTransformer
from sklearn.cluster import KMeans
import os
folder = "pdfs"
model = SentenceTransformer("all-MiniLM-L6-v2")
abstracts, files = [], []
for f in os.listdir(folder):
doc = fitz.open(os.path.join(folder, f))
abstracts.append(doc[0].get_text("text"))
files.append(f)
embeddings = model.encode(abstracts)
labels = KMeans(n_clusters=3).fit_predict(embeddings)
for i, label in enumerate(labels):
dir_path = f"{folder}/cluster_{label}"
os.makedirs(dir_path, exist_ok=True)
os.rename(os.path.join(folder, files[i]), os.path.join(dir_path, files[i]))import fitz
from sentence_transformers import SentenceTransformer
from sklearn.cluster import KMeans
import os
folder = "pdfs"
model = SentenceTransformer("all-MiniLM-L6-v2")
abstracts, files = [], []
for f in os.listdir(folder):
doc = fitz.open(os.path.join(folder, f))
abstracts.append(doc[0].get_text("text"))
files.append(f)
embeddings = model.encode(abstracts)
labels = KMeans(n_clusters=3).fit_predict(embeddings)
for i, label in enumerate(labels):
dir_path = f"{folder}/cluster_{label}"
os.makedirs(dir_path, exist_ok=True)
os.rename(os.path.join(folder, files[i]), os.path.join(dir_path, files[i]))Stay Ahead in Python — Without the Noise 🐍 Click here to Join!
Python Weekly Brief Stop Wasting Hours Hunting for Python ResourcesEvery week, thousands of new Python libraries, AI frameworks, GitHub…
Create a Personal Dashboard with Gradio
All these automations? Build a simple UI to run them.
import gradio as gr
def rename_files(path):
# Your renaming function here
return "Files Renamed"
demo = gr.Interface(fn=rename_files, inputs="text", outputs="text")
demo.launch()import gradio as gr
def rename_files(path):
# Your renaming function here
return "Files Renamed"
demo = gr.Interface(fn=rename_files, inputs="text", outputs="text")
demo.launch()Take This With You
The Complete Python Guide (free, no signup wall) Every core concept, beginner through advanced, with real working code for each one. Read it free here
Once you're comfortable with the foundations, my full paid guide on Gumroad goes further, complete projects and production patterns you can build from directly.
Get the full guide: abdulahad28.gumroad.com
Subscribe to my Gumroad newsletter for a new breakdown like this one every week, free, straight to your inbox. Subscribe here: abdulahad28.gumroad.com