Python Primers #1 - Filesystem Operations with the os, glob, heapq, and zipfile modules

Опубликовано: 04 Август 2026
на канале: BugBytes
1,338
54

In this Python Primer, we'll investigate how to do a variety of filesystem operations, including how to list files/directories, list files of particular types/extensions (using the glob module), sort files according to ordering functions, and how to create ZIP files using the zipfile module.

We'll make use of the built-in sorted function, as well as the handy heapq module, to get specific orderings from the files.

📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
00:24 Listing contents of the current directory
00:38 Listing files in the current directory
01:07 Listing folders in the current directory
01:25 Listing Python files in the current directory
01:51 Sorting files in alphabetical order
02:43 Sorting files by file size in bytes
04:23 Listing top 5 biggest files in the current directory
05:29 Creating ZIP files
06:18 Outro

☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
https://ko-fi.com/bugbytes

▶️ Full Playlist:
   • Python Primers  

𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📖 Blog: https://www.bugbytes.io/posts/python-...
🐦 Twitter:   / bugbytesio  

📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
heapq module: https://docs.python.org/3/library/hea...
os module: https://docs.python.org/3/library/os....
zipfile module: https://docs.python.org/3/library/zip...
glob module: https://docs.python.org/3/library/glo...

#django #htmx #python