DEV Community

Cover image for ๐Ÿ 10 Python Scripts That Will Save You Hours Every Week!!
Nishkarsh Pandey
Nishkarsh Pandey

Posted on

๐Ÿ 10 Python Scripts That Will Save You Hours Every Week!!

Are you still doing repetitive tasks manually?
Itโ€™s time to automate like a boss. ๐Ÿค–๐Ÿ’ก

These Python scripts are small, powerful, and designed to save your time and energyโ€”whether you're a developer, student, freelancer, or just someone who uses a computer daily.

๐Ÿ“ 1. Bulk Rename Files in a Folder

import os
for count, filename in enumerate(os.listdir("my_folder")):
    dst = f"file_{count}.txt"
    os.rename(f"my_folder/{filename}", f"my_folder/{dst}")
Enter fullscreen mode Exit fullscreen mode

โœ”๏ธ Renames all files to file_0.txt, file_1.txt, ...

๐Ÿ“š 2. Merge All PDFs in a Folder

import PyPDF2
import os
merger = PyPDF2.PdfMerger()
for pdf in os.listdir():
    if pdf.endswith(".pdf"):
        merger.append(pdf)
merger.write("merged.pdf")
merger.close()

Enter fullscreen mode Exit fullscreen mode

โœ”๏ธ No more dragging PDFs into online tools. Done locally in seconds.

๐Ÿ“ 3. Extract Text from Any PDF

from PyPDF2 import PdfReader
reader = PdfReader("example.pdf")
text = ""
for page in reader.pages:
    text += page.extract_text()

print(text)
Enter fullscreen mode Exit fullscreen mode

โœ”๏ธ Instantly make any PDF copy-paste friendly.

๐Ÿ–ผ๏ธ 4. Resize All Images in a Folder.

from PIL import Image
import os

for file in os.listdir("images"):
    if file.endswith(".jpg"):
        img = Image.open(f"images/{file}")
        img = img.resize((800, 800))
        img.save(f"images/resized_{file}")

Enter fullscreen mode Exit fullscreen mode

โœ”๏ธ Resize Instagram photos, memes, or assets in bulk.

๐Ÿ’ก 5. Quick Notes to Markdown File.

note = input("Whatโ€™s on your mind? ")
with open("notes.md", "a") as f:
    f.write(f"- {note}\n")
Enter fullscreen mode Exit fullscreen mode

โœ”๏ธ Make your own fast note-taker from the terminal.

โŒ› 6. Pomodoro Timer (25/5 Focus Cycle).

import time

def timer(minutes):
    print(f"โณ Focus for {minutes} minutes!")
    time.sleep(minutes * 60)
    print("โœ… Timeโ€™s up!")
timer(25)
timer(5)
Enter fullscreen mode Exit fullscreen mode

โœ”๏ธ Boost productivity with a custom Pomodoro timer.

๐Ÿ” 7. Generate Strong Random Passwords.

import random
import string
password = ''.join(random.choices(string.ascii_letters + string.digits, k=12))
print("๐Ÿ”", password)
Enter fullscreen mode Exit fullscreen mode

โœ”๏ธ Never reuse a weak password again.

๐Ÿ’ฌ 8. Summarize Any Text in 3 Sentences.

import nltk
nltk.download('punkt')
from nltk.tokenize import sent_tokenize
text = input("Paste your text:\n")
sentences = sent_tokenize(text)
print("\n".join(sentences[:3]))
Enter fullscreen mode Exit fullscreen mode

โœ”๏ธ Quick way to get the gist of long emails or articles.

๐Ÿงน 9. Clean Up Downloads Folder.

import os
import shutil

downloads = "C:/Users/YourName/Downloads"

for file in os.listdir(downloads):
    if file.endswith(".zip"):
        shutil.move(f"{downloads}/{file}", f"{downloads}/Zips/{file}")
Enter fullscreen mode Exit fullscreen mode

โœ”๏ธ Automatically organizes downloaded files.

๐Ÿง  10. Daily Motivation Quote.

import requests
res = requests.get("https://zenquotes.io/api/random")
quote = res.json()[0]['q'] + " โ€”" + res.json()[0]['a']
print(quote)
Enter fullscreen mode Exit fullscreen mode

โœ”๏ธ Start the day with wisdom right from your terminal.

โšก๏ธ Bonus Tip: Turn These Into One-Click Apps
Use Streamlit to turn these scripts into apps with buttons and slidersโ€”no frontend code needed!

๐Ÿ™Œ Wrapping Up
Python isnโ€™t just for AI or backend dev. Itโ€™s your personal time-saving assistant.

Save this post, try these scripts, and let me know which one was your favorite. Or better yet โ€” comment with your own!
๐Ÿง  Want a Part 2 with 10 More Scripts?
๐Ÿ’ฌ Drop a comment or hit โค๏ธ if you found this helpful!

Top comments (0)