
Python Automation Scripts That Will Save You 5+ Hours Per Week
If you're writing the same repetitive tasks every week, you're losing hours that Python could give back. Here are 8 Python automation scripts I use regularly — complete, copy-paste ready. 1. Rename files in bulk import os from pathlib import Path def bulk_rename ( folder , old_ext , new_ext ): folder = Path ( folder ) for file in folder . glob ( f " *. { old_ext } " ): file . rename ( file . with_suffix ( f " . { new_ext } " )) print ( f " Renamed: { file . name } " ) # Example: rename all .jpeg to .jpg bulk_rename ( " ./images " , " jpeg " , " jpg " ) Time saved : 20 minutes per rename session. 2. Send yourself a daily summary email import smtplib from email.mime.text import MIMEText from datetime import datetime def send_summary ( sender , password , recipient , subject , body ): msg = MIMEText ( body ) msg [ " Subject " ] = subject msg [ " From " ] = sender msg [ " To " ] = recipient with smtplib . SMTP_SSL ( " smtp.gmail.com " , 465 ) as server : server . login ( sender , password
Continue reading on Dev.to Python
Opens in a new tab


