The Tech Buffet

The Tech Buffet

Share this post

The Tech Buffet
The Tech Buffet
The Tech Buffet #7: Better Manipulate Paths In Python With Pathlib

The Tech Buffet #7: Better Manipulate Paths In Python With Pathlib

Forget about the os module

Ahmed Besbes's avatar
Ahmed Besbes
Oct 13, 2023
∙ Paid

Share this post

The Tech Buffet
The Tech Buffet
The Tech Buffet #7: Better Manipulate Paths In Python With Pathlib
Share
gray and white pathway between green plants on vast valley

Hello again! 👋

This issue is part of a Python series dedicated to sharing tips and best practices to improve your code.
If you’re interested in this type of content (+ the additional coding material)
consider subscribing.

As a data scientist, I manipulate paths and files on a daily basis to read and write data.

To do this, I typically use the os.path Python module to perform operations such as joining paths, checking the content of a directory, or creating folders.

In this issue, I’m challenging this practice by introducing another path management library called Pathlib.

We’ll see how this library works, how it differs from the os.path module, what features and benefits it provides, and when you should (or not) use it.

If you’re a Python developer, learning about Pathlib will make your code lighter, more flexible, and easier to write and maintain.

Let’s dig in.

Keep reading with a 7-day free trial

Subscribe to The Tech Buffet to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Ahmed Besbes
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share