Skip to main content
Overview

pathlib

September 7, 2021
1 min read

pathlib

ref: https://brownbears.tistory.com/415

Up to now I’d been using os.path.join or os.sep to manually handle path operations. No problems per se, but it’s tedious, the code gets messy, and it’s hard to maintain. Fortunately, Python provides pathlib as a built-in module.

The key idea is to manage paths as objects. It also lets you redefine operators for path operations, so ’/’ can be used immediately as a path separator instead of division.

Loading comments...