Home Chapters Projects About
HomeProjects › Day 39
DAY 39 — 60 DAY PYTHON CHALLENGE

File Organizer

Python mein File Organizer banao — Hindi mein step by step

Advertisement

Project kya hai?

Day 39 ka project hai File Organizer! Yeh project banane se aap Python ke important concepts practice kar payenge. Neeche complete code hai — copy karo aur chalao!

Complete Python Code

python — organizer.py
# File Organizer Simulator
files = [
    "photo.jpg", "document.pdf", "song.mp3",
    "video.mp4", "code.py", "data.csv",
    "image.png", "report.docx", "music.wav",
    "script.js", "notes.txt", "movie.avi",
    "archive.zip", "backup.tar"
]

categories = {
    "Images":    ["jpg", "jpeg", "png", "gif", "bmp", "webp"],
    "Documents": ["pdf", "docx", "txt", "xlsx", "pptx", "doc"],
    "Audio":     ["mp3", "wav", "aac", "flac", "ogg"],
    "Video":     ["mp4", "avi", "mkv", "mov", "wmv"],
    "Code":      ["py", "js", "html", "css", "java", "cpp"],
    "Data":      ["csv", "json", "xml", "sql", "db"],
    "Archive":   ["zip", "tar", "rar", "gz", "7z"],
}

organized = {cat: [] for cat in categories}
organized["Other"] = []

for file in files:
    ext    = file.split(".")[-1].lower()
    placed = False
    for cat, exts in categories.items():
        if ext in exts:
            organized[cat].append(file)
            placed = True
            break
    if not placed:
        organized["Other"].append(file)

print("=== File Organizer ===")
print(f"Total files: {len(files)}")
print("\nOrganized:")
for cat, flist in organized.items():
    if flist:
        print(f"\n  {cat}/")
        for f in flist:
            print(f"    -- {f}")

# Summary
print("\n=== Summary ===")
for cat, flist in organized.items():
    if flist:
        print(f"  {cat:12}: {len(flist)} files")
OUTPUT
=== File Organizer ===
Total files: 14

Organized:

  Images/
    -- photo.jpg
    -- image.png

  Documents/
    -- document.pdf
    -- report.docx

  Audio/
    -- song.mp3
    -- music.wav

=== Summary ===
  Images      : 2 files
  Documents   : 2 files
  Audio       : 2 files

Code kaise kaam karta hai?

split('.')[-1] se file extension milti hai. Nested loops se category match hoti hai. Real os.listdir() se actual files bhi organize kar sakte hain!
Advertisement

📋 Project ka Introduction

File Organizer Python ka Day 39 ka project hai. Is project mein aap Python ke important concepts practice karenge jo real-world applications mein bahut use hote hain.

Yeh project beginners ke liye design kiya gaya hai lekin kaafi concepts cover karta hai. Step by step samjho, code chalao, aur khud modify karke practice karo.

Is tarah ke projects banane se aapka Python confidence badh jaata hai aur aap asli problems solve karna seekh jaate hain. Chaliye code samjhte hain!

🧠 Is Project mein kya seekhoge?

Yeh project banate waqt aap ye Python concepts use karoge:
ConceptKya karta hai
VariablesData store karna
FunctionsReusable code blocks
LoopsRepeat karna
ConditionsDecisions lena
Input/OutputUser se interact karna

📝 Code kaise kaam karta hai — Step by Step

Neeche code ki poori logic step-by-step samjhayi gayi hai:
  1. Problem samjho: File Organizer mein kya karna hai
  2. Required variables aur data structures decide karo
  3. Logic step-by-step likhó
  4. Code mein implement karo
  5. Test karo aur bugs fix karo

⚠️ Common Mistakes — Bhool mat jaana!

Beginners yeh galtiyan aksar karte hain — dhyan rakho:
  • ⚠️ Indentation sahi rakho — Python mein spaces matter karti hain
  • ⚠️ Variables ko use se pehle define karo
  • ⚠️ Input ko int()/float() mein convert karo agar number chahiye
  • ⚠️ Edge cases handle karo — kya hoga agar user galat input de?

🏋️ Practice Exercises — Aage badho!

Yeh project complete karne ke baad in exercises se practice karo:
  • 💡 File Organizer mein naya feature add karo
  • 💡 Code ko functions mein refactor karo
  • 💡 Error handling improve karo
  • 💡 File mein data save karo

❓ Aksar Pooche Jane Wale Sawal (FAQ)

Q: File Organizer project kyon banana chahiye?

A: Har project ek naya concept sikhata hai. Practice se hi Python fluent aati hai.
Q: Code run nahi ho raha?

A: Indentation check karo, syntax errors dekho, variables define hain ya nahi check karo.
Q: Kaise improve karein?

A: Pehle basic version complete karo, phir ek ek feature add karte jao.