Back with 5 more small-but-mighty Python scripts to automate your everyday tasks and boost your productivity!!
π§ 1. Email Yourself a Daily Journal Entry
Save thoughts, goals, or reflections β delivered straight to your inbox.
import smtplib
from email.mime.text import MIMEText
body = input("What's on your mind today?\n")
msg = MIMEText(body)
msg['Subject'] = 'π Daily Journal'
msg['From'] = 'you@example.com'
msg['To'] = 'you@example.com'
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login('you@example.com', 'your_app_password')
server.send_message(msg)
server.quit()
βοΈ Use an App Password if using Gmail.
ποΈ 2. Convert CSV to JSON in Seconds.
Perfect for web devs, APIs, or when switching formats.
import csv
import json
with open('data.csv', 'r') as f:
reader = csv.DictReader(f)
rows = list(reader)
with open('data.json', 'w') as f:
json.dump(rows, f, indent=4)
βοΈ Swap CSV β JSON or vice versa with a quick tweak.
π 3. Find and Replace Text in Multiple Files
Update project files, configs, or logs in bulk.
import os
folder = 'my_project'
for file in os.listdir(folder):
if file.endswith('.txt'):
path = os.path.join(folder, file)
with open(path, 'r+') as f:
content = f.read().replace("OLD_TEXT", "NEW_TEXT")
f.seek(0)
f.write(content)
f.truncate()
βοΈ Automate tedious refactoring or content cleanup.
π΅ 4. Download YouTube Videos as MP3 (Audio Only).
Use this responsibly and for personal content.
from pytube import YouTube
url = input("YouTube URL: ")
yt = YouTube(url)
stream = yt.streams.filter(only_audio=True).first()
stream.download(filename="audio.mp3")
βοΈ Turn lectures, podcasts, or tutorials into offline audio.
π 5. Check If Your Internet Is Working (and Speed)
import speedtest
st = speedtest.Speedtest()
print(f"Download: {st.download() / 1_000_000:.2f} Mbps")
print(f"Upload: {st.upload() / 1_000_000:.2f} Mbps")
βοΈ Use in automation or when debugging slow web apps.
πͺ§ Like These? Here's What You Can Do:
β
Bookmark this post
π¬ Comment your favorite one
π Follow me β because Part 3 might be next π
Top comments (1)
I always thought Python was mostly for big projects, but seeing these quick scripts really made me realize how much it can help with everyday tasks. The CSV to JSON and internet speed tester were especially eye-opening for me!