Sourse_code – Telegram
Sourse_code
255 subscribers
76 photos
75 videos
36 files
56 links
Download Telegram
یک تیکه کد خیلی کاربردی با پایتون که کارش اینه بهش اسم درایو رو میدید و اون خودش چک میکنه و سنگین ترین پوشه های توی اون درایو رو بهتون میده با ادرسشون
python 
import os
import humanize
from colorama import Fore, Style, init
init(autoreset=True)

def folder_size(path):
total = 0
for root, dirs, files in os.walk(path, onerror=None):
for f in files:
try:
fp = os.path.join(root, f)
total += os.path.getsize(fp)
except:
pass
return total
def list_drives():
drives = []
for letter in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
drive_path = f"{letter}:\\"
if os.path.exists(drive_path):
drives.append(drive_path)
return drives
def main():
print(Fore.CYAN + "\n=== Available Drives ===\n")

drives = list_drives()
for i, drive in enumerate(drives, 1):
print(Fore.YELLOW + f"{i} = {drive}")
print(Fore.YELLOW + f"{len(drives)+1} = ALL drives")

print(Fore.MAGENTA + "\nSelect drives by number (example: 1,2 or 2,4,6):")

user_input = input(Fore.WHITE + "Your choice: ")

selected = [x.strip() for x in user_input.split(",")]

if str(len(drives)+1) in selected:
selected_drives = drives
else:
selected_drives = []
for s in selected:
if s.isdigit() and 1 <= int(s) <= len(drives):
selected_drives.append(drives[int(s)-1])

print(Fore.GREEN + "\n=== Scanning Selected Drives ===\n")

for drive in selected_drives:
print(Fore.CYAN + f"\nDrive: {drive}")
print(Fore.CYAN + "----------------------------")

items = []
try:
for name in os.listdir(drive):
full_path = os.path.join(drive, name)
if os.path.isdir(full_path):
print(Fore.YELLOW + f"Checking: {full_path}")
size = folder_size(full_path)
items.append((name, full_path, size))
except PermissionError:
print(Fore.RED + "Access denied.")
continue

items.sort(key=lambda x: x[2], reverse=True)

print(Fore.GREEN + "\nTop 10 Heaviest Folders:\n")

for i, (name, path, size) in enumerate(items[:10], 1):
print(
Fore.MAGENTA
+ f"{i}. {name}"
+ Fore.WHITE
+ f" | Path: {path}"
+ Fore.YELLOW
+ f" | Size: {humanize.naturalsize(size)}"
)

print(Fore.CYAN + "\nDone.\n")

if __name__ == "__main__":
main()
1
این mdb جاکش چجوری عوض میشه به sqlite3 کلا نمیتونم بازش کنم با پایتون
1
𝓗𝔂𝓹𝓮𝓻𝓢𝓮𝓻𝓿𝓮𝓻
Video
نت رایگان همراه اول
حاجی یه اکستنشن پیدا کردم رو vscode خیلی گاده برا کد نویسی هم میشه api key مدل های مختلف رو داد تا اونا کار کنن هم از مدل خودش استفاده کرد خیلی خوبه این اسمش cline نصبش کنید لذتشو ببرید
برق کل شهر ما رفت الان