Back to Browse

Python Primers #3 - os vs pathlib modules for path/filesystem operations

7.2K views
Jan 20, 2022
9:41

In this video, we will look at two modules in Python that can be used to build paths and check whether files/directories exist. 1. the "os" module - an older module that contains a range of different utilities 2. the "pathlib" module - a newer module (Python 3.4+) that contains object-oriented utilities for working with paths/files. โ˜•๏ธ ๐—•๐˜‚๐˜† ๐—บ๐—ฒ ๐—ฎ ๐—ฐ๐—ผ๐—ณ๐—ณ๐—ฒ๐—ฒ: To support the channel and encourage new videos, please consider buying me a coffee here: https://ko-fi.com/bugbytes โ–ถ๏ธ Full Playlist: https://www.youtube.com/playlist?list=PL-2EBeDYMIbRLMCcFBwDlbjxnIW91qzgD ๐Ÿ“Œ ๐—–๐—ต๐—ฎ๐—ฝ๐˜๐—ฒ๐—ฟ๐˜€: 00:00 Intro 00:17 os module 00:59 os module: check if path exists 01:36 os module: check if path is a file 02:28 os module: get current directory 02:46 os module: building paths 03:20 os module: check if path is a directory 04:02 pathlib module 04:16 pathlib module: Path object 04:47 pathlib module: resolve() function 05:36 pathlib module: check if path exists 05:58 pathlib module: check if path is a file 06:12 pathlib module: check if path is a directory 06:27 pathlib module: building paths 07:48 pathlib module: getting file extension 08:19 os module: getting file extension 09:06 Summary 09:00 outro ๐—ฆ๐—ผ๐—ฐ๐—ถ๐—ฎ๐—น ๐— ๐—ฒ๐—ฑ๐—ถ๐—ฎ: ๐Ÿ“– Blog: https://www.bugbytes.io/posts/ ๐Ÿฆ Twitter: https://twitter.com/bugbytesio ๐Ÿ“š ๐—™๐˜‚๐—ฟ๐˜๐—ต๐—ฒ๐—ฟ ๐—ฟ๐—ฒ๐—ฎ๐—ฑ๐—ถ๐—ป๐—ด ๐—ฎ๐—ป๐—ฑ ๐—ถ๐—ป๐—ณ๐—ผ๐—ฟ๐—บ๐—ฎ๐˜๐—ถ๐—ผ๐—ป: datetime module: https://docs.python.org/3/library/datetime.html os module: https://docs.python.org/3/library/os.html zipfile module: https://docs.python.org/3/library/zipfile.html Python generators: https://realpython.com/introduction-to-python-generators/ #python #os #pathlib

Download

1 formats

Video Formats

360pmp415.3 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Python Primers #3 - os vs pathlib modules for path/filesystem operations | NatokHD