15 Python Scripts That Simplify Everyday Tasks — By ToolzamAI
In today’s fast-paced world, automation is the key to efficiency. Python, with its versatility and simplicity, offers scripts that can transform mundane daily tasks into effortless operations. In this article, we explore 15 futuristic Python scripts that can simplify your life. If you’re intrigued by robotics and AI tools, visit ToolzamAI — a hub featuring 500+ AI tools and insights on emerging robots worldwide.
1. Automated Email Sender
Task: Send daily emails without opening your inbox .
import smtplib
from email.message import EmailMessage
def send_email(subject, body, to_email):
msg = EmailMessage()
msg.set_content(body)
msg['Subject'] = subject
msg['From'] = 'your_email@example.com'
msg['To'] = to_email
with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp:
smtp.login('your_email@example.com', 'your_password')
smtp.send_message(msg)
send_email("Daily Update", "Here's your update!", "receiver@example.com")
2. Voice Assistant
Task: Get reminders, weather updates, or control smart devices via voice commands.
import pyttsx3
import speech_recognition as sr
def voice_assistant():
recognizer = sr.Recognizer()
engine = pyttsx3.init()
try:
with sr.Microphone() as source:
print("Listening...")
audio = recognizer.listen(source)
command = recognizer.recognize_google(audio)
engine.say(f"You said: {command}")
engine.runAndWait()
except Exception as e:
print("Error:", e)
voice_assistant()
3. Smart Expense Tracker
Task: Track your daily expenses with a simple CSV log.
import csv
def log_expense(amount, category):
with open('expenses.csv', mode='a', newline='') as file:
writer = csv.writer(file)
writer.writerow([amount, category])
log_expense(50, 'Groceries')
4. Automated Data Backup
Task: Schedule backups of critical files to cloud or local storage.
import shutil
from datetime import datetime
def backup_file(file_path, backup_dir):
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
shutil.copy(file_path, f"{backup_dir}/{timestamp}_backup.txt")
backup_file('data.txt', 'backups')
5. AI Photo Enhancer
Task: Automatically enhance your photos with Python.
from PIL import Image, ImageEnhance
def enhance_photo(image_path, output_path):
image = Image.open(image_path)
enhancer = ImageEnhance.Sharpness(image)
enhanced_image = enhancer.enhance(2.0)
enhanced_image.save(output_path)
enhance_photo('input.jpg', 'enhanced.jpg')
6. Password Generator
Task: Generate secure, random passwords.
import random
import string
def generate_password(length=12):
characters = string.ascii_letters + string.digits + string.punctuation
return ''.join(random.choice(characters) for _ in range(length))
print(generate_password())
7. News Aggregator
Task: Fetch and display the latest news headlines.
import requests
def get_news():
response = requests.get('https://newsapi.org/v2/top-headlines?country=us&apiKey=your_api_key')
for article in response.json().get('articles', []):
print(article['title'])
get_news()
8. Health Reminder
Task: Remind yourself to drink water or take breaks.
import time
from plyer import notification
def health_reminder():
while True:
notification.notify(title="Health Reminder", message="Time to drink water!", timeout=10)
time.sleep(3600)
health_reminder()
9. Online Shopping Price Tracker
Task: Monitor price drops on your favorite items.
import requests
from bs4 import BeautifulSoup
def track_price(url):
headers = {"User-Agent": "Your User Agent"}
response = requests.get(url, headers=headers)
soup = BeautifulSoup(response.text, 'html.parser')
price = soup.find('span', {'class': 'price'}).text
print(f"Current Price: {price}")
track_price("https://example.com/product")
10. Real-Time Weather App
Task: Fetch live weather updates for your location.
import requests
def get_weather(city):
api_key = 'your_api_key'
url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}"
response = requests.get(url)
data = response.json()
print(f"Weather in {city}: {data['weather'][0]['description']}")
get_weather("New York")
11. Smart Grocery List Generator
Task: Create weekly grocery lists based on recipes.
def generate_grocery_list(recipes):
ingredients = set()
for recipe in recipes:
ingredients.update(recipe)
return list(ingredients)
print(generate_grocery_list([{"eggs", "milk"}, {"bread", "butter"}]))
12. Task Scheduler
Task: Schedule reminders or tasks throughout the day.
import schedule
import time
def task():
print("Time to complete your task!")
schedule.every().day.at("09:00").do(task)
while True:
schedule.run_pending()
time.sleep(1)
13. Habit Tracker
Task: Keep track of daily habits.
def habit_tracker(habit, days):
progress = {day: False for day in range(1, days + 1)}
return progress
print(habit_tracker("Exercise", 30))
14. File Organizer
Task: Automatically sort and organize files in a directory.
import os
import shutil
def organize_files(directory):
for file in os.listdir(directory):
ext = file.split('.')[-1]
folder = f"{directory}/{ext}"
os.makedirs(folder, exist_ok=True)
shutil.move(f"{directory}/{file}", folder)
organize_files('downloads')
15. Personal Budget Analyzer
Task: Analyze and visualize your monthly budget.
import matplotlib.pyplot as plt
def analyze_budget(expenses):
labels, values = zip(*expenses.items())
plt.pie(values, labels=labels, autopct='%1.1f%%')
plt.title('Monthly Budget Distribution')
plt.show()
analyze_budget({'Rent': 1000, 'Food': 500, 'Transport': 200})
Discover More:
Want to explore more futuristic solutions like AI tools or the latest advancements in robotics? Head over to ToolzamAI and dive into a world of 500+ AI tools and innovations in robotics.