os & pathlib
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
Modulet os dhe pathlib punojnë me skedarë dhe dosje: Path("notat.txt").exists() kontrollon nëse ekziston, Path.cwd() jep dosjen aktuale, glob("*.py") gjen skedarët. pathlib është mënyra moderne.
EnglishEN
The os and pathlib modules work with files and folders: Path("grades.txt").exists() checks if it exists, Path.cwd() gives the current folder, glob("*.py") finds files. pathlib is the modern way.
Si ta mendosh
Si Finder-i ose File Explorer-i, por i kontrolluar me kod.
Lexoje në anglisht
Like Finder or File Explorer, but controlled with code.
Shembull kodipython
from pathlib import Path
dosja = Path("detyrat")
dosja.mkdir(exist_ok=True)
for f in dosja.glob("*.py"):
print(f.name)