Most Python tutorials teach you to print "Hello World"
and call it a day. I got bored of that fast.
So I started building things that actually do something —
scripts that save time, clean data, and automate tasks
that would otherwise take hours of manual work. Here's
everything I've built so far, with the code.
1. Web scraper
Copying data from websites by hand is painful.
This script does it in seconds.
import requests
from bs4 import BeautifulSoup
import pandas as pd
response = requests.get('https://books.toscrape.com')
soup = BeautifulSoup(response.text, 'html.parser')
books = []
for book in soup.find_all('article', class_='product_pod'):
title = book.find('h3').find('a')['title']
price = book.find('p', class_='price_color').text
books.append({'title': title, 'price': price})
pd.DataFrame(books).to_csv('books.csv', index=False)
print(f"Scraped {len(books)} books")
Point it at any website with consistent HTML structure
and it pulls the data into a clean CSV automatically.
2. File organiser
My downloads folder was a disaster.
400 files, no structure, impossible to find anything.
This script fixed it in three seconds.
import os, shutil
def organise(folder):
categories = {
'.pdf': 'PDFs', '.csv': 'Spreadsheets',
'.xlsx': 'Spreadsheets', '.jpg': 'Images',
'.png': 'Images', '.py': 'Scripts', '.txt': 'Text'
}
for filename in os.listdir(folder):
filepath = os.path.join(folder, filename)
if os.path.isdir(filepath):
continue
_, ext = os.path.splitext(filename)
dest = os.path.join(folder, categories.get(ext.lower(), 'Others'))
os.makedirs(dest, exist_ok=True)
shutil.move(filepath, os.path.join(dest, filename))
print(f"Moved {filename}")
Run it once and your folder organises itself.
Every file type goes into its own subfolder.
3. Email automation
There's a whole category of emails that are identical
every time — weekly reports, payment reminders,
confirmation messages. Why send them manually?
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
def send_email(to, subject, body):
msg = MIMEMultipart()
msg['From'] = "you@gmail.com"
msg['To'] = to
msg['Subject'] = subject
msg.attach(MIMEText(body, 'plain'))
with smtplib.SMTP_SSL('smtp.gmail.com', 465) as server:
server.login("you@gmail.com", "your-app-password")
server.send_message(msg)
print(f"Sent to {to}")
Use a Gmail App Password, not your real password.
Pair it with the schedule library and it runs
on a timer without you touching anything.
4. Regex data extractor
Raw text is messy. Emails in different formats,
phone numbers with and without country codes,
dates written six different ways.
Regex cuts through all of it.
import re
def extract_all(text):
return {
'emails': re.findall(
r'[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+',
text),
'phones': re.findall(
r'[6-9]\d{9}',
text),
'dates': re.findall(
r'\d{4}-\d{2}-\d{2}|\d{2}/\d{2}/\d{4}',
text)
}
sample = "Contact hr@company.in or call 9876543210 before 2024-03-15"
print(extract_all(sample))
# {'emails': ['hr@company.in'], 'phones': ['9876543210'], 'dates': ['2024-03-15']}
Feed it a document, a scraped webpage,
or a pile of form responses — it pulls
out exactly what you need.
5. CSV and Excel cleaner
Real data is never clean. I've seen spreadsheets
where the same city is written as "bangalore",
"Bangalore", "BANGALORE", and "Bengaluru" —
all in the same column.
My cleaner handles all of it — strips whitespace,
fixes capitalisation, removes duplicates,
standardises formats, fills missing values
with column averages.
One function call. Clean file out the other end.
6. Selenium browser scraper
Some websites load their content with JavaScript
after the page opens. requests and BeautifulSoup
never see that data — they only get the initial HTML.
Selenium opens a real Chrome browser, waits for
everything to load, then scrapes it like a human would.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument('--headless') # no visible window
driver = webdriver.Chrome(options=options)
driver.get('https://quotes.toscrape.com/js/')
quotes = driver.find_elements(By.CLASS_NAME, 'text')
for q in quotes:
print(q.text)
driver.quit()
7. Smart data cleaner
This one ties everything together.
Takes a messy real-world dataset — broken emails,
phone numbers in five formats, salaries with
currency symbols and commas, inconsistent
department names — and runs it through a full
cleaning pipeline using pandas, NumPy, and regex.
Output is a clean, analysis-ready CSV with a
summary report showing what changed and why.
It's the script I'm most proud of.
The kind of thing you'd actually hand to a client.
Find the script on my github.
github.com/raaga102005
What would you automate if you knew how?
Top comments (0)