🔵 🔵 🔵


Primary

၊၊||၊|။

pathlib ⚬⃕ᵖʸ|Documentation|1st|20251125131558-00-⌔

pathlib — Object-oriented filesystem paths — Python 3.14.0 documentation

pathlib — Object-oriented filesystem paths

Added in version 3.4.

Source code: Lib/pathlib/

This module offers classes representing filesystem paths with semantics appropriate for different operating systems. Path classes are divided between pure paths, which provide purely computational operations without I/O, and concrete paths, which inherit from pure paths but also provide I/O operations.

🖼️ ➺

If you’ve never used this module before or just aren’t sure which class is right for your task, Path is most likely what you need. It instantiates a concrete path for the platform the code is running on.

Pure paths are useful in some special cases; for example:

  • If you want to manipulate Windows paths on a Unix machine (or vice versa). You cannot instantiate a WindowsPath when running on Unix, but you can instantiate PureWindowsPath.
  • You want to make sure that your code only manipulates paths without actually accessing the OS. In this case, instantiating one of the pure classes may be useful since those simply don’t have any OS-accessing operations.

See also: PEP 428: The pathlib module – object-oriented filesystem paths.

See also: For low-level path manipulation on strings, you can also use the os.path module.

Printed 2026-06-28.

(echo:: @ )

Link to original

Secondary

• • •