DEV Community

Anna lilith
Anna lilith

Posted on

Python Automation: Make DailyTasks Easier

Python Automation: Make DailyTasks Easier

Introduction

Do you hate doing the same chores over and over? Python can help! It’s a tool that can do boring tasks like renaming files or sending emails for you. Whether you’re a student, worker, or just busy, writing simple scripts can save you time.

In this post, we’ll show you how to use Python for real tasks. We’ll cover file sorting, email sending, and web scraping—with code you can copy and use now. Let’s make boring jobs automatic!


Main Content: Automate with Python

1. Automate File Sorting

Don’t want to rename 100 files by hand? Python can do it fast. Here’s a script to rename all .txt files in a folder:

import os  # This is a tool to work with files

folder_path = '/your/folder/here'  # Change this to your folder

for file_name in os.listdir(folder_path):  # Go through each file
    if file_name.endswith('.txt'):  # Only rename .txt files
        new_name = 'new_' + file_name  # Add "new_" to the name
        os.rename(os.path.join(folder_path, file_name), os.path.join(folder_path, new_name))  # Rename it
        print(f'Renamed {file_name} to {new_name}')  # Show what happened
Enter fullscreen mode Exit fullscreen mode

How it helps:

  • Automatically renames files.
  • You can change it to sort files by date or move them to folders.

Use case:

  • Sort photos or backup files without clicking.

2. Send Emails Without Typing

Don’t want to write emails every day? Python can send them for you. Example:

import smtplib  # Tool to send emails
from email.mime.text import MIMEText  # Tool to build emails

your_email = 'your_email@example.com'  # Your email
password = 'your_password'  # Your password
other_email = 'friend@example.com'  # Who to send to
subject = 'Hello!'  # Email title
message = 'Your report is ready!'  # What to say

email = MIMEText(message)  # Build the email
email['Subject'] = subject  # Add title
email['From'] = your_email  # Who it’s from
email['To'] = other_email  # Who it’s to

try:
    with smtplib.SMTP('smtp.gmail.com', 587) as server:  # Use Gmail’s server
        server.starttls()  # Secure connection
        server.login(your_email, password)  # Log in
        server.sendmail(your_email, other_email, email.as_string())  # Send
    print('Email sent!')  # Success!
except:  # If it fails
    print('Oops, something went wrong.') 
Enter fullscreen mode Exit fullscreen mode

Tips:

  • Run this script every day without you checking.
  • Make emails personal by adding info from a spreadsheet.

3. Grab Data from Websites

Want stock prices or news updates? Python can pull this info automatically. Example:

import requests  # Tool to visit websites
from bs4 import BeautifulSoup  # Tool to pick text from websites

site = 'https://example-news-site.com'  # Change to the site
web_page = requests.get(site)  # Visit the site
soup = BeautifulSoup(web_page.text, 'html.parser')  # Read the text

# Find headlines (change "h2" and "title" to match the site’s layout)
headlines = soup.find_all('h2', class_='title') 
for title in headlines: 
    print(title.text.strip())  # Show the text
Enter fullscreen mode Exit fullscreen mode

Important:

  • Check if the site allows scraping (like a “no robots” rule).
  • For sites with JavaScript, use another tool like Selenium.

Use case:

  • Track prices or monitor social media.

Real-Life Automation Ideas

Python can handle many daily tasks:

  • Forms: Fill in online forms automatically.
  • Backups: Save important files without remembering.
  • Calendars: Auto-sort your to-do list.

Automation saves time and reduces mistakes.


Get the Scripts

Want to try these? Download the ready-to-use Python scripts here (replace with real link). They’re tested and easy to use.


Final Thoughts

Automation isn’t just for experts—anyone can do it. Start with small tasks, try the code, and grow your skills.

Need help? Ask in the comments!


Why this works:

  • Short sentences (most under 15 words).
  • Simple words (no jargon like “smtplib” → “email tool”).
  • Active voice (“Python sends emails” not “emails can be sent”).
  • Code examples kept with clear comments.

Get the Production-Ready Version

Don't want to build it yourself? We have production-ready versions of these tools at https://reply-continues-exams-confidential.trycloudflare.com.

What you get:

  • Complete, tested Python code
  • Documentation and setup guides
  • Instant delivery after crypto payment
  • Free updates

Browse the collection →

Top comments (0)